I'm running PHPunit to test my ZF2 application. I tried it on my Windows machine (under xampp), and it worked fine. But when I moved it to a virtual Ubuntu 14.10 server, I keep getting the following error with every test:
Undefined variable: services
I went to /etc/php5/cli/php.ini and set error reporting as follows:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
The code the tests are pointing to is from one of my Module.php files
public function onBootstrap(MvcEvent $event)
{
$sharedEventManager = $event->getApplication()
->getEventManager()
->getSharedManager();
$sharedEventManager->attach('user', 'log-fail', function($event) use ($services) {
$username = $event->getParam('username');
$log = $services->get('log');
$log->warn("Error logging user [$username]");
});
}
It's specifically complaining about the line $sharedEventManager->attach('user', 'log-fail', function($event) use ($services)
. Like I said, I tried editing the php.ini files to suppress warnings like this, but it isn't working. Is there something else I'm missing?