PHPUnit 6.2 Fatal error: Class 'Eloquent' not found in /.../Database/Model.php

Viewed 1097

In PHPUnit 5.x I was having no issues. Once I upgraded to 6.2 I started getting the following error: Fatal error: Class 'Eloquent' not found in /my/app/Database/Model.php on line 14 I performed a composer dump-autoload already. Because it was working before, I assume it's because of a change in the newer version to how the TestCase.php should be set up, but I can't find anything solid.

In the test itself, I am calling the parent setup method like this

Test setup method:

public function setUp()
    {
        parent::setUp();
    }

TestCase.php:

class TestCase extends Illuminate\Foundation\Testing\TestCase {
    protected $baseUrl = 'http://whatever.thing';
    public $user;
    public $password;
    public $mockUser;
    public function createApplication() {
        //Server address used by the test suite's instance of $_SERVER.
        $_SERVER['REMOTE_ADDR'] = isset($_SERVER['REMOTE_ADDR'])? $_SERVER['REMOTE_ADDR']:'127.0.0.1';

        $app = require __DIR__.'/../bootstrap/app.php';

        $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();

        return $app;
    }

}
1 Answers
Related