I want to test this function:
static protected function getContainerInterface()
{
global $kernel;
if (get_class($kernel) == 'AppCache') {
/** @var \AppCache $cache */
$cache = $kernel;
$kernel = $cache->getKernel();
}
return $kernel->getContainer();
}
And got an error: Call to a member function getContainer() on null triggered by this string:
return $kernel->getContainer();
How can I pass global $kernel object to crawler( that is instance of FunctionalTester) in codeception ?
A global variable is a bad practice. I can assume that when running tests, codeception creates its own test kernel and this kernel can not be used globally. This place needs to be refactored