lundi 19 octobre 2015

Impossible to test

Impossible test this construct

github code

public function __construct(ContainerInterface $container)
{
    $this->container = $container;
    $this->data['gitDir'] = $this->container->get('kernel')->getRootDir(); 
}

This is my test:

 public function testInstantiationWithArgumentsShouldWork()
{
    $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
    $container->expects($this->any())
        ->method('get')
        ->will($this->returnValue('\Symfony\Component\HttpKerne\KernelInterface'));

    $instance = new GitDataCollector($container);

}

Error ocurred

PHP Fatal error:  Call to a member function getRootDir() on a non-object in /var/www/html/debugToolbar/src/Kendrick/SymfonyDebugToolbarGit/DataCollector/GitDataCollector.php on line 30

show me how to do... thank

Aucun commentaire:

Enregistrer un commentaire