Skip to content

Commit

Permalink
test with an array
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmastech committed Feb 2, 2025
1 parent 8d65bc3 commit 6f13580
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/Integration/Migration/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Illuminate\Support\Stringable;
use Mockery as m;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\TestWith;
use Symfony\Component\Console\Output\OutputInterface;

class MigratorTest extends TestCase
Expand Down Expand Up @@ -66,23 +65,22 @@ public function testMigrateWithoutOutput()
$this->assertTrue(DB::getSchemaBuilder()->hasColumn('people', 'last_name'));
}

#[TestWith(['2015_10_04_000000_modify_people_table.php'], 'filename with extension')]
#[TestWith(['2015_10_04_000000_modify_people_table'], 'filename without extension')]
public function testWithSkippedMigrations(string $filename)
public function testWithSkippedMigrations()
{
$this->app->forgetInstance('migrator');
$this->subject = $this->app->make('migrator');

Migrator::withoutMigrations([$filename]);
Migrator::withoutMigrations(['2015_10_04_000000_modify_people_table.php', '2016_10_04_000000_modify_people_table']);

$this->subject->run([__DIR__.'/fixtures']);
$this->assertTrue(DB::getSchemaBuilder()->hasTable('people'));
$this->assertFalse(DB::getSchemaBuilder()->hasColumn('people', 'first_name'));
$this->assertTrue(DB::getSchemaBuilder()->hasColumn('people', 'last_name'));
$this->assertFalse(DB::getSchemaBuilder()->hasColumn('people', 'last_name'));

Migrator::withoutMigrations([]);
$this->subject->run([__DIR__.'/fixtures']);
$this->assertTrue(DB::getSchemaBuilder()->hasColumn('people', 'first_name'));
$this->assertTrue(DB::getSchemaBuilder()->hasColumn('people', 'last_name'));
}

public function testRollback()
Expand Down

0 comments on commit 6f13580

Please sign in to comment.