/** * Test changeset name validation. */ public function testFindMigrations() { $finder = new MigrationsInChangesetsFinder($this->log, '', $this->migrations_path); $this->assertFalse($finder->isValidChangesetName('2016-01-01')); $this->assertFalse($finder->isValidChangesetName('fix-users-table')); $this->assertTrue($finder->isValidChangesetName('2016-01-01-fix-users-table')); }
/** * Test if we can successfully load info from multiple migration dirs. */ public function testMultipleMigrationDirs() { $finder = new MigrationsInChangesetsFinder($this->log, 'ActiveCollab\\DatabaseMigrations\\Test\\NamepsacedMigrations', $this->migrations_path, dirname(__DIR__) . '/changesets/inject_in_migrations_with_changeset'); $map = $finder->getMigrationClassFilePathMap(); $this->assertInternalType('array', $map); $this->assertCount(5, $map); $this->assertArrayHasKey('\\ActiveCollab\\DatabaseMigrations\\Test\\NamepsacedMigrations\\AddUsersTable', $map); $this->assertArrayHasKey('\\ActiveCollab\\DatabaseMigrations\\Test\\NamepsacedMigrations\\AddFieldToUsersTable', $map); $this->assertArrayHasKey('\\ActiveCollab\\DatabaseMigrations\\Test\\NamepsacedMigrations\\AddIndexToTheNewField', $map); $this->assertArrayHasKey('\\ActiveCollab\\DatabaseMigrations\\Test\\NamepsacedMigrations\\AddIndexesToUsersTable', $map); $this->assertArrayHasKey('\\ActiveCollab\\DatabaseMigrations\\Test\\NamepsacedMigrations\\AddUserRolesTable', $map); }
public function testChangesetCanBeSpcifiedWithTimestamp() { $this->assertEquals("{$this->migrations_path}/2013-10-02-my-custom-changeset-name/DoSomethingAwesome.php", $this->finder->prepareMigrationPath('DoSomethingAwesome', $this->migrations_path, '2013-10-02-my custom changeset name')); }