Vagrant, Codeception & Laravel issue. NotFoundHttpException

前端 未结 3 535
北恋
北恋 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).

    0 讨论(0)
  • 2021-01-28 04:24

    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.

    0 讨论(0)
  • 2021-01-28 04:24

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

    0 讨论(0)
提交回复
热议问题