Skip to content

Commit

Permalink
Fixed tests after adding schema dumps for test database
Browse files Browse the repository at this point in the history
  • Loading branch information
korridor committed Jul 1, 2024
1 parent c0c678a commit 62ac23c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
16 changes: 4 additions & 12 deletions tests/Unit/Database/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,15 @@
namespace Tests\Unit\Database;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Artisan;
use Tests\TestCase;

class MigrationTest extends \Tests\TestCase
class MigrationTest extends TestCase
{
use RefreshDatabase;

public function test_fresh_migration_and_rollback_runs_successfully(): void
{
Artisan::call('migrate:fresh');
Artisan::call('migrate:rollback');
$this->assertTrue(true);
}

public function testFreshMigrationWithSeederAndRollbackRunsSuccessfully(): void
{
Artisan::call('migrate:fresh --seed');
Artisan::call('migrate:rollback');
$this->assertTrue(true);
$this->artisan('migrate:rollback')
->assertSuccessful();
}
}
18 changes: 10 additions & 8 deletions tests/Unit/Database/SeederTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@
namespace Tests\Unit\Database;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Artisan;
use Tests\TestCase;

class SeederTest extends \Tests\TestCase
class SeederTest extends TestCase
{
use RefreshDatabase;

public function test_running_the_seeder_multiple_times_runs_successfully(): void
{
Artisan::call('db:seed');
Artisan::call('db:seed');
$this->assertTrue(true);
$this->artisan('db:seed')
->assertSuccessful();
$this->artisan('db:seed')
->assertSuccessful();
}

public function test_fresh_migration_with_seeder_and_rollback_runs_successfully(): void
{
Artisan::call('migrate:fresh --seed');
Artisan::call('migrate:rollback');
$this->assertTrue(true);
$this->artisan('db:seed')
->assertSuccessful();
$this->artisan('migrate:rollback')
->assertSuccessful();
}
}

0 comments on commit 62ac23c

Please sign in to comment.