title: Symfony, Call service in PHP Unit
body: <p>I have a unit test, where I need to call a service.</p>
  
  <p>I did it that way:</p>
  
  <pre><code>&lt;?php
  namespace FM\PriceBundle\Tests\Service;
  
  use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
  
  class PriceServiceTest extends KernelTestCase
  {
      private $container;
  
      public function testFiulPrice()
      {
          self::bootKernel();
          $this-&gt;container = self::$kernel-&gt;getContainer();
  
          $productId = 1;
          $id = 1;
          $what = ['postal', 'departement', 'region', 'country', 'insee'];
          $date = new \DateTime('2016-06-23');
  
          $price = $this-&gt;container-&gt;get('fm.price.get')-&gt;fiulPrice($productId, $id, $what[0], $date);
  
          $this-&gt;assertNotEmpty($price);
      }
  }
  </code></pre>
  
  <p>But I have this error:</p>
  
  <blockquote>
    <p>There was 1 error:</p>
    
    <p>1) FM\PriceBundle\Tests\Service\PriceServiceTest::testFiulPrice 
    Predis\Connection\ConnectionException: Connection refused [tcp://localhost:6379]</p>
  </blockquote>