Codeception Error : Call to undefined method Exception::getStatusCode()
Codeception Error : Call to undefined method Exception::getStatusCode()
当我在 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?
之间的错误配置
问题与Codeception本身无关。看起来您已经手动编辑了 Handler.php 文件。您必须修复更改中的错误(调用未定义的方法非常清楚)或将其恢复到原始状态。
当我在 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?
之间的错误配置问题与Codeception本身无关。看起来您已经手动编辑了 Handler.php 文件。您必须修复更改中的错误(调用未定义的方法非常清楚)或将其恢复到原始状态。