Skip to content

Commit

Permalink
fixes for phinx 0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
nojimage committed Feb 10, 2023
1 parent f927440 commit 35ba7d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Model/Migration/MigrationGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ public function getLastMigration(): ?MigrationStatus
/**
* 指定バージョンまでマイグレーションを実行する
*
* @param string $id migration ID
* @param string|int $id migration ID
* @return string
* @throws \Exception
*/
public function migrateTo(string $id): string
public function migrateTo($id): string
{
$manager = $this->getManager();
$manager->migrate($this->getConfig()->getDefaultEnvironment(), $id);
$manager->migrate($this->getConfig()->getDefaultEnvironment(), (int)$id);

return $this->output->fetch();
}
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Model/Migration/MigrationGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testConstructApp(): void
$this->assertRegExp('!^' . $configPathMatch . '/Migrations$!', $object->getConfig()->getMigrationPaths()[0]);
$this->assertRegExp('!^' . $configPathMatch . '/Seeds$!', $object->getConfig()->getSeedPaths()[0]);
$environment = $object->getConfig()->getEnvironment('default');
$this->assertSame('phinxlog', $environment['default_migration_table']);
$this->assertSame('phinxlog', $environment['migration_table'] ?? $environment['default_migration_table']);
}

/**
Expand All @@ -82,7 +82,7 @@ public function testConstructPlugin(): void
Plugin::configPath('Elastic/MigrationManager') . 'Seeds',
], $object->getConfig()->getSeedPaths());
$environment = $object->getConfig()->getEnvironment('default');
$this->assertSame('elastic_migration_manager_phinxlog', $environment['default_migration_table']);
$this->assertSame('elastic_migration_manager_phinxlog', $environment['migration_table'] ?? $environment['default_migration_table']);
}

/**
Expand All @@ -96,7 +96,7 @@ public function testGetMigrations(): void
$first = $migrations->first();
$this->assertInstanceOf(MigrationStatus::class, $first);
$this->assertSame('down', $first->status);
$this->assertSame('20191008091658', $first->id);
$this->assertSame('20191008091658', (string)$first->id);
$this->assertSame('InitForTest', $first->name);
}

Expand All @@ -109,7 +109,7 @@ public function testGetLastMigration(): void

$this->assertInstanceOf(MigrationStatus::class, $last);
$this->assertSame('down', $last->status);
$this->assertSame('20191008091959', $last->id);
$this->assertSame('20191008091959', (string)$last->id);
$this->assertSame('ThirdMigrationForTest', $last->name);
}

Expand Down

0 comments on commit 35ba7d2

Please sign in to comment.