【发布时间】:2015-10-20 00:50:06
【问题描述】:
当我在 Laravel 的 Codeception 中运行功能测试时,我时不时会收到错误消息:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Exception::getStatusCode()
这些是我的配置:
codeception.yml
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: 'mysql:host=127.0.0.1;port=3306;dbname=la51'
user: 'root'
password: 'root'
populate: false
cleanup: false
reconnect: true
functional.suite.yml
class_name: FunctionalTester
modules:
enabled:
# add framework module here
- \Helper\Functional
- Asserts
- Db
- Laravel5
config:
Laravel5:
cleanup: false
这是我“codecept run”时在终端中得到的:
Rubens-MacBook-Pro:la51 rubenbijker$ codecept run -vvv
Codeception PHP Testing Framework v2.1.3
Powered by PHPUnit 4.8.10 by Sebastian Bergmann and contributors.
Acceptance Tests (0) ------------------------
Modules: PhpBrowser, \Helper\Acceptance
---------------------------------------------
---------------------------------------------
Functional Tests (9) -------------------------------------------------------------------------------------------------------------------------------
Modules: \Helper\Functional, Asserts, Db, Laravel5
----------------------------------------------------------------------------------------------------------------------------------------------------
Create a boat (AdminCreatesBoatCept)
Scenario:
* As an a guest
* I am on page ""
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Exception::getStatusCode()
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Exception::getStatusCode()
FATAL ERROR. TESTS NOT FINISHED.
Call to undefined method Exception::getStatusCode()
in /Applications/MAMP/htdocs/la51/app/Exceptions/Handler.php:71
Rubens-MacBook-Pro:la51 rubenbijker$
我报告了 Codeception 的问题,但他们说这是 Laravel 错误,所以他们无法帮助我。 这是由于我的代码中的错误引起的吗?还是因为 Codeception 和 Laravel 之间的错误配置?
【问题讨论】:
-
表示抛出的异常没有声明方法“getStatusCode”
-
什么版本的 Codeception?它看起来像一个错误。请通过github.com/Codeception/Codeception/issues 报告问题
-
Codeception 版本 2.1.3。我会在github上报告。谢谢。
-
我已经在github上报告了这个问题:github.com/Codeception/Codeception/issues/2466
-
至少是默认的,连71行都没有。
标签: php laravel-5.1 codeception