Я в настоящее время разрабатываю небольшой пакет и хотел добавить тесты для него, но каким-то образом класс TestCase
моего пакета не найден.
Вот сообщение об ошибке:
PHP Fatal error: Uncaught Error: Class 'Tjventurini\GetRelationshipKey\Tests\TestCase' not found in /home/vagrant/code/get-relationship-key.local/packages/get-relationship-key/tests/BelongsToUserTest.php:5
Вот мой composer файл:
{
"name": "tjventurini/get-relationship-key",
"description": "Trait and sample configuration to manage model relationships via configurations.",
"type": "package",
"keywords": [
"tjventurini",
"laravel",
"eloquent",
"get-relationship-key"
],
"license": "MIT",
"authors": [
{
"name": "Thomas Venturini",
"email": "me@example.com"
}
],
"require": {
"illuminate/support": "^6.0"
},
"autoload": {
"psr-4": {
"Tjventurini\\GetRelationshipKey\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tjventurini\\GetRelationshipKey\\Tests\\": "tests/"
}
}
}
Вот скриншот моей файловой структуры:
Тест, который выдает ошибку:
<?php
namespace Tjventurini\GetRelationshipKey\Tests;
class BelongsToUserTest extends TestCase
{
/**
* Test the BelongsTo relationship on the test model.
*
* @return void
*/
public function testBelongsToUser(): void
{
}
}
И, наконец, класс, вызывающий проблемы ...
<?php
namespace Tjventurini\GetRelationshipKey\Tests;
use Tests\CreatesApplication;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Setup the test suite.
*
* @return void
*/
protected function setUp(): void
{
$this->setupConfiguration();
}
/**
*
*/
private function setupConfiguration()
{
config('database.models', ['foo' => 'bar']);
dd(config('database'));
}
}
Было бы замечательно, если бы кто-то мог сказать мне, что я здесь упускаю. Спасибо! ?