Skip to content

Commit

Permalink
Add setTables test
Browse files Browse the repository at this point in the history
  • Loading branch information
msmakouz committed Oct 30, 2023
1 parent 2b15a20 commit 383cca3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Migrations/AtomizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
namespace Cycle\Migrations\Tests;

use Cycle\Database\Injection\Fragment;
use Cycle\Database\Schema\AbstractTable;
use Cycle\Migrations\Atomizer\Atomizer;
use Cycle\Migrations\Atomizer\Renderer;
use Cycle\Migrations\Migration;
use Cycle\Migrations\State;

Expand Down Expand Up @@ -428,4 +431,19 @@ public function testChangeColumnScale(): void
$this->migrator->rollback();
$this->assertFalse($this->db->hasTable('sample'));
}

public function testSetTables(): void
{
$atomizer = new Atomizer(new Renderer());

$table1 = $this->createMock(AbstractTable::class);
$table2 = $this->createMock(AbstractTable::class);
$table3 = $this->createMock(AbstractTable::class);

$atomizer->addTable($table1);
$this->assertSame([$table1], $atomizer->getTables());

$atomizer->setTables([$table2, $table3]);
$this->assertSame([$table2, $table3], $atomizer->getTables());
}
}

0 comments on commit 383cca3

Please sign in to comment.