I have narrowed my problem down to a single unit-test which involves a pretty clean dbal query. The query involves a nestedsets and the failure occurs when I go from 3 to 4 levels of hierarchical categories. Very little changes in terms of execution time.. And the functionality I'm work with has no problem at 10 level. However, in PhpUnit when I run the test with 4 or more levels -- I get a fatal error.
*To summarize, a query that may take a split second more than usual OR a tab bit more resources is getting me a php fatal error
in PHPUnit
*
And the Error Looks like this:
Fatal error: Call to undefined method Monolog\Formatter\LineFormatter::stopEvent() in /var/www/my-app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/Stopwatch.php on line 92
Someone here had a phpUnit fatal error problem on line 92 as well. Could it be related??
I've listed some quirky ways (below) to bypass my problem but I'd still like to know why such a basic test seems to be causing this problem.
- Run PhpUnit with
processIsolation
set to "true". - Don't access the
static::createClient();
in the setUpBeforeClass() method
I've had a respected member of #symfony (Stof) suggest that it looks like I'm improperly DI'ing @logger into a service.. but I've confirmed this doesn't seem to be the by taking the logger service out of any of my services.
Maybe this issue has something to do with a timeout? (The error mentions stopevent
and stopwatch
). Or maybe this error has something to do with accessing $client = static::createClient();
in setUpBeforeClass()
.. and then accessing is again in preceding tests.. Regardless.. it's confusing me and as far as I can tell, everything else in my Symfony2 (2.1.1) installation is working perfectly fine.
* LINE 92 of Stopwatch.php .. github source file here *
/**
* Stops an event.
* @param string $name The event name
* @return StopwatchEvent A StopwatchEvent instance
*/
public function stop($name)
{ return end($this->activeSections)->stopEvent($name);}