Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rawilk committed Mar 6, 2024
1 parent 8ea7f7e commit 74908be
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion tests/ArchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -35,4 +37,4 @@ public function up(): void
$table->timestamps();
});
}
};
}
20 changes: 12 additions & 8 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@

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
{
return [
HumanKeysServiceProvider::class,
];
}

public function getEnvironmentSetUp($app)
{
$migration = include __DIR__ . '/Fixture/migrations/create_test_tables.php';
(new $migration)->up();
}
}

0 comments on commit 74908be

Please sign in to comment.