【发布时间】:2016-01-17 03:45:49
【问题描述】:
为了测试,我需要使用另一个数据库,而不是 local 环境。
我在开发流程中使用 homestead 和 Laravel 5.2 + Behat3 + Mink。
当我从主机运行 behat 时,这没问题 - 变量设置为 APP_ENV=testing。
但是在宅基地机器内设置testing 环境时遇到问题:APP_ENV 始终为local。
-
对于测试环境(
APP_ENV)我修改了标准welcome.blade.php下一条路:- <div class="title">Laravel 5</div> + <div class="title">Laravel 5 ({!! app()->environment() !!})</div> -
我已经配置了
behat.yml:default: extensions: Laracasts\Behat: env_path: .env.behat Behat\MinkExtension: default_session: laravel laravel: ~ -
我在
.env.behat中的测试环境变量:APP_ENV=testing APP_DEBUG=true DB_CONNECTION=sqlite -
我做了我的 home.feature:
Feature: Check home page In order to verify home page As a user I need to see text Laravel and an environment name @home Scenario: Home Page Given I am on the homepage Then I should see "Laravel 5 (testing)"
所以当我运行 behat 时,我看到 Laravel 5 (local) 但看不到 Laravel 5 (testing) 文本:
Feature: Check home page
In order to verify home page
As a user
I need to see Laravel text
@home
Scenario: Home Page # features/home.feature:7
Given I am on the homepage # FeatureContext::iAmOnHomepage()
Then I should see "Laravel 5 (testing)" # FeatureContext::assertPageContainsText()
The text "Laravel 5 (testing)" was not found anywhere in the text of the current page. (Behat\Mink\Exception\ResponseTextException)
--- Failed scenarios:
features/home.feature:7
1 scenario (1 failed)
我在配置中遗漏了什么,或者关于自定义设置 Laravel 配置我应该知道什么?
【问题讨论】:
标签: php behat homestead mink laravel-5.2