I'm using laravel7 and codeception; and I have an Api test class called abcCest
located inside test/api
folder.
it looks like this:
<?php
use Tests\TestCase;
class abcCest extends TestCase
{}
the parent class TestCase
has the following content:
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}
I keep getting the error:
PHP Fatal error: Trait 'Tests\CreatesApplication' not found in /var/www/tests/TestCase.php on line 7
which is the exact place where i use the trait. The problem is that the trait CreatesApplication
exists inside the vendor folder under the path: vendor/laravel/laravel/tests/CreatesApplication.php
and this is its content:
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}
in my composer.json
file i have the following already set:
"autoload": {
"psr-4": {
"App\\": "app/",
"Tests\\": "tests/"
},
"classmap": [
"database/",
"library/"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
}
i ran composer dump-autoload many times but still keep on getting the same error...