diff --git a/composer.json b/composer.json index d9d4a49..09d0389 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,8 @@ }, "autoload-dev": { "psr-4": { - "Rawilk\\HumanKeys\\Tests\\": "tests/" + "Rawilk\\HumanKeys\\Tests\\": "tests/", + "Rawilk\\HumanKeys\\Tests\\Fixture\\Migrations\\": "tests/Fixture/migrations/" } }, "scripts": { diff --git a/tests/ArchTest.php b/tests/ArchTest.php index db47936..38382f3 100644 --- a/tests/ArchTest.php +++ b/tests/ArchTest.php @@ -3,5 +3,5 @@ declare(strict_types=1); it('will not use debugging functions') - ->expect(['dd', 'dump', 'ray']) + ->expect(['dd', 'dump', 'ray', 'var_dump', 'ddd']) ->each->not->toBeUsed(); diff --git a/tests/Fixture/migrations/create_test_tables.php b/tests/Fixture/migrations/CreateTestTables.php similarity index 91% rename from tests/Fixture/migrations/create_test_tables.php rename to tests/Fixture/migrations/CreateTestTables.php index 44a805e..c5628dd 100644 --- a/tests/Fixture/migrations/create_test_tables.php +++ b/tests/Fixture/migrations/CreateTestTables.php @@ -2,11 +2,13 @@ declare(strict_types=1); +namespace Rawilk\HumanKeys\Tests\Fixture\Migrations; + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration +class CreateTestTables extends Migration { public function up(): void { @@ -35,4 +37,4 @@ public function up(): void $table->timestamps(); }); } -}; +} diff --git a/tests/TestCase.php b/tests/TestCase.php index cf1b81c..3bfc032 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,13 +2,23 @@ namespace Rawilk\HumanKeys\Tests; -use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Orchestra\Testbench\TestCase as Orchestra; use Rawilk\HumanKeys\HumanKeysServiceProvider; +use Rawilk\HumanKeys\Tests\Fixture\Migrations\CreateTestTables; class TestCase extends Orchestra { - use LazilyRefreshDatabase; + public function getEnvironmentSetUp($app) + { + $app['config']->set('database.default', 'sqlite'); + $app['config']->set('database.connections.sqlite', [ + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '', + ]); + + (new CreateTestTables)->up(); + } protected function getPackageProviders($app): array { @@ -16,10 +26,4 @@ protected function getPackageProviders($app): array HumanKeysServiceProvider::class, ]; } - - public function getEnvironmentSetUp($app) - { - $migration = include __DIR__ . '/Fixture/migrations/create_test_tables.php'; - (new $migration)->up(); - } }