php - Laravel 5.2: Setup APP_ENV for testing -


for testing need use database in local environment.

i use homestead , laravel 5.2 + behat3 + mink in development flow.

when run behat host machine it's ok - variable setting app_env=testing.

but have trouble setting testing environment when same inside homestead machine: app_env local.

  1. for testing environment (app_env) modified standard welcome.blade.php next way:

    - <div class="title">laravel 5</div> + <div class="title">laravel 5 ({!! app()->environment() !!})</div> 
  2. i've configured behat.yml:

    default:     extensions:         laracasts\behat:             env_path: .env.behat         behat\minkextension:             default_session: laravel             laravel: ~ 
  3. my testing environment variables in .env.behat:

    app_env=testing app_debug=true db_connection=sqlite 
  4. i made home.feature:

    feature: check home page   in order verify home page   user   need see text laravel , environment name    @home   scenario: home page     given on homepage     should see "laravel 5 (testing)" 

so when run behat see laravel 5 (local) not laravel 5 (testing) text:

    feature: check home page       in order verify home page       user       need see laravel text        @home       scenario: home page                       # features/home.feature:7         given on homepage              # featurecontext::iamonhomepage()         should see "laravel 5 (testing)" # featurecontext::assertpagecontainstext()           text "laravel 5 (testing)" not found anywhere in text of current page. (behat\mink\exception\responsetextexception)      --- failed scenarios:          features/home.feature:7      1 scenario (1 failed) 

what missed in configuration or should know custom setup laravel configuration?

i don't know if it's case, make sure in homestead.yaml don't have:

variables:     - key: app_env       value: local 

if do, remove , can try provision vm, it's quite possible need destroy (you should first backup example database etc.) , create again after removing file.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -