本文整理匯總了PHP中Doctrine_Migration::hasMigrated方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Migration::hasMigrated方法的具體用法?PHP Doctrine_Migration::hasMigrated怎麽用?PHP Doctrine_Migration::hasMigrated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine_Migration
的用法示例。
在下文中一共展示了Doctrine_Migration::hasMigrated方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testMigration
public function testMigration()
{
$migration = new Doctrine_Migration('migration_classes');
$this->assertFalse($migration->hasMigrated());
$migration->setCurrentVersion(3);
$migration->migrate(0);
$this->assertEqual($migration->getCurrentVersion(), 0);
$this->assertEqual($migration->getLatestVersion(), 4);
$this->assertEqual($migration->getNextVersion(), 5);
$current = $migration->getCurrentVersion();
$migration->setCurrentVersion(100);
$this->assertEqual($migration->getCurrentVersion(), 100);
$migration->setCurrentVersion($current);
$migration->migrate(3);
$this->assertTrue($migration->hasMigrated());
$this->assertEqual($migration->getCurrentVersion(), 3);
$this->assertTrue($this->conn->import->tableExists('migration_phonenumber'));
$this->assertTrue($this->conn->import->tableExists('migration_user'));
$this->assertTrue($this->conn->import->tableExists('migration_profile'));
$migration->migrate(4);
$this->assertFalse($this->conn->import->tableExists('migration_profile'));
$migration->migrate(0);
$this->assertEqual($migration->getCurrentVersion(), 0);
$this->assertTrue($migration->getMigrationClass(1) instanceof AddPhonenumber);
$this->assertTrue($migration->getMigrationClass(2) instanceof AddUser);
$this->assertTrue($migration->getMigrationClass(3) instanceof AddProfile);
$this->assertTrue($migration->getMigrationClass(4) instanceof DropProfile);
$this->assertFalse($this->conn->import->tableExists('migration_phonenumber'));
$this->assertFalse($this->conn->import->tableExists('migration_user'));
$this->assertFalse($this->conn->import->tableExists('migration_profile'));
}
示例2: testMigration
public function testMigration()
{
$migration = new Doctrine_Migration('migration_classes');
$this->assertFalse($migration->hasMigrated());
$migration->setCurrentVersion(3);
$migration->migrate(0);
$this->assertEqual($migration->getCurrentVersion(), 0);
$this->assertEqual($migration->getLatestVersion(), 11);
$this->assertEqual($migration->getNextVersion(), 12);
$current = $migration->getCurrentVersion();
$migration->setCurrentVersion(100);
$this->assertEqual($migration->getCurrentVersion(), 100);
$migration->setCurrentVersion($current);
$migration->migrate(3);
$this->assertTrue($migration->hasMigrated());
$this->assertEqual($migration->getCurrentVersion(), 3);
$this->assertTrue($this->conn->import->tableExists('migration_phonenumber'));
$this->assertTrue($this->conn->import->tableExists('migration_user'));
$this->assertTrue($this->conn->import->tableExists('migration_profile'));
$migration->migrate(4);
$this->assertFalse($this->conn->import->tableExists('migration_profile'));
$migration->migrate(0);
$this->assertEqual($migration->getCurrentVersion(), 0);
$this->assertTrue($migration->getMigrationClass(1) instanceof AddPhonenumber);
$this->assertTrue($migration->getMigrationClass(2) instanceof AddUser);
$this->assertTrue($migration->getMigrationClass(3) instanceof AddProfile);
$this->assertTrue($migration->getMigrationClass(4) instanceof DropProfile);
$this->assertFalse($this->conn->import->tableExists('migration_phonenumber'));
$this->assertFalse($this->conn->import->tableExists('migration_user'));
$this->assertFalse($this->conn->import->tableExists('migration_profile'));
$this->assertEqual(array(1 => 'AddPhonenumber', 2 => 'AddUser', 3 => 'AddProfile', 4 => 'DropProfile', 5 => 'Test5', 6 => 'Test6', 7 => 'Test7', 8 => 'Test8', 9 => 'Test9', 10 => 'Test10', 11 => 'Test11'), $migration->getMigrationClasses());
}