php - PHPUnit error undefined variable -


i'm running phpunit test zf2 application. tried on windows machine (under xampp), , worked fine. when moved virtual ubuntu 14.10 server, keep getting following error every test:

undefined variable: services 

i went /etc/php5/cli/php.ini , set error reporting follows:

error_reporting = e_all & ~e_deprecated & ~e_strict & ~e_notice 

the code tests pointing 1 of 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 complaining line $sharedeventmanager->attach('user', 'log-fail', function($event) use ($services). said, tried editing php.ini files suppress warnings this, isn't working. there else i'm missing?

ok, figured out. indrasinh bihola said: i'd left part out. well, book did. snippet borrowed earlier section, skips crucial parts, , gives no indication of original part (37 pages back!). also, not make excuses, i've never used closures in php , had no idea use($services) did. do. won't make same mistake again.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -