Rbijker.com
Rbijker.com

Reputation: 3114

Codeception Error : Call to undefined method Exception::getStatusCode()

When I run functional tests in Codeception in Laravel, every now and then I get the error:

 [Symfony\Component\Debug\Exception\FatalErrorException]  
  Call to undefined method Exception::getStatusCode() 

These are my configs:

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

This is what I get in my terminal when I "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$ 

I reported the issue with Codeception but they said it is a Laravel error so they can't help me. Is this caused because of an error in my code? Or by a misconfiguration between Codeception and Laravel?

Upvotes: 3

Views: 4497

Answers (1)

shock_gone_wild
shock_gone_wild

Reputation: 6740

The problem has nothing to do with Codeception itself. It rather Looks like you have edited your Handler.php file manually. You have to fix the error in your changes ( Call to undefined method is quite clear ) or revert it to its orignal state.

Upvotes: 5

Related Questions