Skip to content

Instantly share code, notes, and snippets.

@velikanov
Created April 17, 2015 14:33
Show Gist options
  • Save velikanov/a3814c1fdf89b017454c to your computer and use it in GitHub Desktop.
Save velikanov/a3814c1fdf89b017454c to your computer and use it in GitHub Desktop.
PHPSpec+Symfony Issue
<?php
namespace AppBundle\Service;
use Symfony\Component\DependencyInjection\Container;
abstract class AbstractService implements SomeInterface {
protected $container;
public function __construct(Container $container)
{
$this->container = $container;
}
}
...
class ChildService extends AbstractService {}
<?php
namespace spec\AppBundle\Service;
use PhpSpec\ObjectBehavior;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ChildServiceSpec extends AbstractService
{
public function let(ContainerInterface $container)
{
$this->beConstructedWith($container);
}
public function it_is_initializable()
{
$this->shouldHaveType('AppBundle\Service\ChildService');
}
}
./bin/phpspec run
AppBundle/Service/ChildService
19 - it is initializable
error: Argument 1 passed to AppBundle\Service\AbstractService::__construct() must be an instance of
Symfony\Component\DependencyInjection\Container, instance of Double\ContainerInterface\P1 given
100% 1
1 specs
1 example (1 broken)
40ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment