Codeception错误:调用未定义方法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文件。您必须修复更改中的错误(调用未定义方法非常清楚)或将其恢复到原始状态。