Situation
I am using phpunit (4.1.10) and phpunitBundle (4.1.*) in order to unit test my symfony2 (2.4.4) application. I am using phpwamp (alias for php of wamp) version 5.4.10, php installed on computer being rather old (version 5.3.28).
Testing usually works fine.
Issue
When using router->generate(a_route), it returns an error.
public function setUp()
{
static::$kernel = static::createKernel();
static::$kernel->boot();
$this->em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->container = static::$kernel->getContainer();
}
public function testFoo(){
/*temp*/
$x = $this->container->get('router')->generate('my_route');
}
ERROR:
F.PHP Parse error: parse error in /path_to_project/project/src/Foo/FooBundle /Controller/FooController.php on line xx
Solution:
I observe that the parse error occurs in FooController.php, whereas I am not at all testing a controller (its an entityRepo test). however, php line hint is usually useless when it comes to parse error, so ..
In the same time, this does not come form a real parse error, as the same generation works perfectly well when tested manually.
Any hint about this phpunit issue / ways to bypass it ? Many thanks in advance for your help