testing - Can't perform a Laravel 4 action/route test more than once -
i'm running laravel 4 testing issue: action/route test can run once, , has first test run. subsequent action/route test fail exception before assert called.
- route/action tests run long first test run.
- non-route/action tests run normally, although cause subsequent route/action tests throw exception
it's important note tests in question don't fail, throw exception when action fired, example:
symfony\component\routing\exception\routenotfoundexception: unable generate url named route "home" such route not exist. sample test class:
class exampletest extends testcase { // passes public function testone() { $class = myapp::apiresponse(); $this->assertinstanceof('\myapp\services\apiresponse', $class); } // fails unless moved top of file public function testroute() { $this->route('get','home'); $this->asserttrue($this->client->getresponse()->isok()); } // passes public function testtwo() { $class = myapp::projectservice(); $this->assertinstanceof('\myapp\services\projectservice', $class); } } this implementation-specific, fresh laravel 4 project not exhibit issue. causing behaviour? how go tracking down problem?
in case, routes file being called using include_once call. when subsequent tests run routes empty.
changing include() fixed issue exhibited in question
Comments
Post a Comment