Php laravel中的Codeception在功能测试期间不显示异常
我正在尝试做BDD风格的项目。到目前为止,一切都安排好了。问题是,如果我有这样的东西:Php laravel中的Codeception在功能测试期间不显示异常,php,laravel-5,codeception,Php,Laravel 5,Codeception,我正在尝试做BDD风格的项目。到目前为止,一切都安排好了。问题是,如果我有这样的东西: $I->amOnPage('/login'); $I->fillField('email', 'test@example.com'); $I->fillField('passord', 'secret'); $I->submitForm(); $I->assertTrue(Auth::check()); class_name: FunctionalTester modules:
$I->amOnPage('/login');
$I->fillField('email', 'test@example.com');
$I->fillField('passord', 'secret');
$I->submitForm();
$I->assertTrue(Auth::check());
class_name: FunctionalTester
modules:
enabled:
- \Helper\Functional
- Asserts
- Laravel5:
environment_file: .env.testing
到目前为止我还没有路由,所以我希望codecept运行会显示异常。但它只告诉我:
1) Failed to test valid login in DemanderAuthorizationCest::testValidLogin (tests/functional/DemanderAuthorizationCest.php)
Step I fill field "email","test@example.com"
Fail Form field by Label or CSS 'email' was not found.
我相信这是因为拉威尔的错误处理,但我不知道如何修复它
我的functional.suite.yml如下所示:
$I->amOnPage('/login');
$I->fillField('email', 'test@example.com');
$I->fillField('passord', 'secret');
$I->submitForm();
$I->assertTrue(Auth::check());
class_name: FunctionalTester
modules:
enabled:
- \Helper\Functional
- Asserts
- Laravel5:
environment_file: .env.testing
谢谢。我通过以下方式解决了这个问题:
class Handler extends ExceptionHandler
{
// ...
public function report(Exception $e)
{
if (App::environment() == 'testing') {
throw $e;
}
return parent::report($e);
}
// ...
}
看起来您正在运行验收测试。