Vagrant, Codeception & Laravel issue. NotFoundHttpException

前端 未结 3 530
北恋
北恋 2021-01-28 03:32

I\'m trying to get into using codeception for my acceptance testing.

I have the following for one of my tests:



        
3条回答
  •  醉梦人生
    2021-01-28 04:10

    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).

提交回复
热议问题