Skip to content

Commit e22ce19

Browse files
committed
“ The best way to take care of the future is to take care of the present moment. ”
— Thich Nhat Hanh
1 parent a4b924c commit e22ce19

File tree

7 files changed

+72
-40
lines changed

7 files changed

+72
-40
lines changed

.github/workflows/run-tests.yml

-3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,3 @@ jobs:
5353

5454
- name: Execute tests
5555
run: vendor/bin/pest --ci
56-
# use sqlite for testing
57-
env:
58-
DB_CONNECTION: sqlite

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ phpunit.xml
88
phpstan.neon
99
testbench.yaml
1010
vendor
11-
node_modules
12-
database/migrations/2024_07_07_131035_create_saved_models_table.php
11+
node_modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up()
10+
{
11+
Schema::create('saved_models', function (Blueprint $table) {
12+
$table->id();
13+
$table->string('event_version')->default('1.0.0');
14+
$table->string('event');
15+
$table->string('model');
16+
$table->string('key', 40);
17+
$table->bigInteger('model_version')->default(1);
18+
$table->string('property');
19+
$table->longText('value')->nullable();
20+
$table->json('values');
21+
22+
$table->timestamps();
23+
24+
$table->unique(['model', 'model_version', 'key']);
25+
});
26+
27+
Schema::create('saved_model_snapshots', function (Blueprint $table) {
28+
$table->id();
29+
$table->string('model');
30+
$table->string('key', 40);
31+
$table->bigInteger('model_version')->default(1);
32+
$table->foreignId('saved_model_id');
33+
$table->json('values');
34+
});
35+
}
36+
};

tests/ArchTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

3-
// arch('it will not use debugging functions')
4-
// ->expect(['dd', 'dump', 'ray'])
5-
// ->each->not->toBeUsed();
3+
arch('it will not use debugging functions')
4+
->expect(['dd', 'dump', 'ray'])
5+
->each->not->toBeUsed();

tests/MigrationTest.php

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
<?php
22

3-
// use Illuminate\Support\Facades\Schema;
3+
use Illuminate\Support\Facades\Schema;
44

5-
// use function Pest\Laravel\assertDatabaseHas;
6-
// use function Pest\Laravel\assertDatabaseMissing;
7-
// use function PHPUnit\Framework\assertFalse;
8-
// use function PHPUnit\Framework\assertTrue;
5+
use function Pest\Laravel\assertDatabaseHas;
6+
use function Pest\Laravel\assertDatabaseMissing;
7+
use function PHPUnit\Framework\assertFalse;
8+
use function PHPUnit\Framework\assertTrue;
99

10-
// it('can create the saved_models table', function () {
11-
// $this->artisan('ecow:migrate')->assertExitCode(0);
10+
it('can create the saved_models table', function () {
11+
$this->artisan('ecow:migrate')->assertExitCode(0);
1212

13-
// assertDatabaseHas('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
13+
assertDatabaseHas('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
1414

15-
// assertTrue(Schema::hasTable('saved_models'));
16-
// });
15+
assertTrue(Schema::hasTable('saved_models'));
16+
});
1717

18-
// it('can run migrations with --fresh option', function () {
19-
// $this->artisan('ecow:migrate')->assertExitCode(0);
20-
// $this->artisan('ecow:migrate --fresh')->assertExitCode(0);
18+
it('can run migrations with --fresh option', function () {
19+
$this->artisan('ecow:migrate')->assertExitCode(0);
20+
$this->artisan('ecow:migrate --fresh')->assertExitCode(0);
2121

22-
// assertDatabaseHas('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
22+
assertDatabaseHas('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
2323

24-
// assertTrue(Schema::hasTable('saved_models'));
25-
// });
24+
assertTrue(Schema::hasTable('saved_models'));
25+
});
2626

27-
// it('can run migrations with --wipe option', function () {
28-
// $this->artisan('ecow:migrate')->assertExitCode(0);
29-
// $this->artisan('ecow:migrate --wipe')->assertExitCode(0);
27+
it('can run migrations with --wipe option', function () {
28+
$this->artisan('ecow:migrate')->assertExitCode(0);
29+
$this->artisan('ecow:migrate --wipe')->assertExitCode(0);
3030

31-
// assertDatabaseMissing('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
31+
assertDatabaseMissing('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
3232

33-
// assertFalse(Schema::hasTable('saved_models'));
34-
// });
33+
assertFalse(Schema::hasTable('saved_models'));
34+
});
3535

36-
// it('can run migrations with --log-only option', function () {
37-
// $this->artisan('ecow:migrate')->assertExitCode(0);
38-
// $this->artisan('ecow:migrate --wipe')->assertExitCode(0);
39-
// $this->artisan('ecow:migrate --log-only')->assertExitCode(0);
36+
it('can run migrations with --log-only option', function () {
37+
$this->artisan('ecow:migrate')->assertExitCode(0);
38+
$this->artisan('ecow:migrate --wipe')->assertExitCode(0);
39+
$this->artisan('ecow:migrate --log-only')->assertExitCode(0);
4040

41-
// assertDatabaseHas('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
41+
assertDatabaseHas('migrations', ['migration' => '2024_07_07_131035_create_saved_models_table']);
4242

43-
// assertFalse(Schema::hasTable('saved_models'));
44-
// });
43+
assertFalse(Schema::hasTable('saved_models'));
44+
});

tests/Pest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
uses()
88
->beforeEach(function () {
9-
// $this->artisan('ecow:migrate')->assertExitCode(0);
9+
$this->artisan('ecow:migrate')->assertExitCode(0);
1010
})
1111
->in('Feature');

tests/TestCase.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getEnvironmentSetUp($app)
2828
{
2929
config()->set('database.default', 'testing');
3030

31-
$migration = include __DIR__.'/../database/migrations/2024_07_07_131035_create_saved_models_table.php';
32-
$migration->up();
31+
// $migration = include __DIR__.'/../database/migrations/2024_07_07_131035_create_saved_models_table.php';
32+
// $migration->up();
3333
}
3434
}

0 commit comments

Comments
 (0)