From fab711c6660dcb446e863de9d6c442d01edaa53e Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 6 Jun 2024 00:06:55 -0400 Subject: [PATCH] Add test for #722 I wasn't able to reproduce this issue in the test suite. --- .../TestCase/Command/RollbackCommandTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/TestCase/Command/RollbackCommandTest.php b/tests/TestCase/Command/RollbackCommandTest.php index 3fdbd08e..1468533c 100644 --- a/tests/TestCase/Command/RollbackCommandTest.php +++ b/tests/TestCase/Command/RollbackCommandTest.php @@ -199,6 +199,28 @@ public function testTargetOption(): void $this->assertFileDoesNotExist($dumpFile); } + public function testPluginOption(): void + { + $this->loadPlugins(['Migrator']); + $this->exec('migrations migrate -c test --plugin Migrator --no-lock'); + $this->assertExitSuccess(); + + // migration state was recorded. + $phinxlog = $this->fetchTable('MigratorPhinxlog'); + $this->assertEquals(1, $phinxlog->find()->count()); + // Table was created. + $this->assertNotEmpty($this->fetchTable('Migrator')->getSchema()); + + $this->resetOutput(); + + $this->exec('migrations rollback -c test --plugin Migrator --no-lock'); + $this->assertExitSuccess(); + + $this->assertOutputContains('Migrator: reverted'); + // No more recorded migrations + $this->assertEquals(0, $phinxlog->find()->count()); + } + public function testLockOption(): void { $migrationPath = ROOT . DS . 'config' . DS . 'Migrations';