lundi 21 septembre 2015

Can't access variables from _bootstrap.php in codeception

I test my laravel5 application using codeception and because I need a user for most of my unit tests I tried to create one in my unit/_bootstrap.php file:

$user = \App\User::register($credentials);

But it seems like this file is not getting loaded into my tests since I cant access the $user variable. The test always fails with the following error:

[PHPUnit_Framework_Exception] Undefined variable: user

I use the default codeception configuration and just added the laravel5 module. Also I know for sure that the bootstrap file gets executed since I can break the tests by throwing an exception in there.

Aucun commentaire:

Enregistrer un commentaire