Vagrant, Codeception & Laravel issue. NotFoundHttpException

断了今生、忘了曾经 提交于 2019-12-02 10:32:52

Laravel4 module will cause Codeception to use the "testing" environment in Laravel.

Laravel will disable all route filters in "testing" environment - so your filters are not working correctly and its probably calling the wrong route, causing your app to die and your test to fail.

I dont think using the Laravel4 module with "acceptance" tests is correct - it should only be for functional tests? Edit: I just found that the Codeception Laravel4 module docs actually say "This module allows you to run functional tests for Laravel 4" - so I guess it was not actually designed for Acceptance tests?

But with all the changes in Codeception 2.x - you are better off using PhpBrowser module for your acceptance tests, and Laravel4 module for your functional tests.

If you are using Homestead, I do this in my start.php file to detect if Codeception is running, and specifically put it into a 'codeception' environment, otherwise I let it run my environment detection normally

if ((gethostname() === 'homestead') && (isset($_SERVER['REMOTE_ADDR'])) && ($_SERVER['REMOTE_ADDR'] === '127.0.0.1'))
{
    $env = $app->detectEnvironment(['codeception' => ['homestead']]);
}
else
{
    $env = $app->detectEnvironment(['dev' => ['homestead']]);
}

Then in my 'codeception' environment, I setup a SQLite file database, and run acceptance tests against that (which is faster than mySQL testing).

You don't even have to change your start.php. You can set the environment for codecption in the laravel4 Module config. So in your acceptance.suite.yml it will look like this:

modules: enabled: [PhpBrowser, WebHelper, Laravel4] config: Laravel4: environment : 'codeception' filters : true

Now, when you execute php codecept run acceptance in your terminal, the Laravel4 Module will use the configuration files from app/config/codeception.

Was not able to find a solution to this, so for now am going to just go without the Laravel4 module, sadly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!