0
私はサービスを呼び出す必要がある単体テストを持っています。Symfony、PHPでのコールサービスユニット
私はそれをそのようにやった:
<?php
namespace FM\PriceBundle\Tests\Service;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class PriceServiceTest extends KernelTestCase
{
private $container;
public function testFiulPrice()
{
self::bootKernel();
$this->container = self::$kernel->getContainer();
$productId = 1;
$id = 1;
$what = ['postal', 'departement', 'region', 'country', 'insee'];
$date = new \DateTime('2016-06-23');
$price = $this->container->get('fm.price.get')->fiulPrice($productId, $id, $what[0], $date);
$this->assertNotEmpty($price);
}
}
をしかし、私はこのエラーを持っている:
There was 1 error:
1) FM\PriceBundle\Tests\Service\PriceServiceTest::testFiulPrice Predis\Connection\ConnectionException: Connection refused [tcp://localhost:6379]
サービスにエラーがあるようです...どこに接続しようとしていますか? –
テスト環境のサービスパラメータ設定を確認する – Matteo