From 61274843ed759ed3a25a532404fef807c3916c6f Mon Sep 17 00:00:00 2001 From: samw3 Date: Mon, 15 Oct 2007 23:39:20 +0000 Subject: [PATCH] Testing migration addColumn --- tests/MigrationTestCase.php | 5 ++++- tests/migration_classes/001_add_table.php | 25 ++++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/MigrationTestCase.php b/tests/MigrationTestCase.php index 50b00ebda..9162523c4 100644 --- a/tests/MigrationTestCase.php +++ b/tests/MigrationTestCase.php @@ -37,8 +37,11 @@ class Doctrine_Migration_TestCase extends Doctrine_UnitTestCase // New migration for the 'migration_classes' directory $migration = new Doctrine_Migration('migration_classes'); - // migrate to version 2 + // migrate to version 3 $migration->migrate(2); + + // Make sure the column was added + $this->assertTrue(Doctrine_Manager::getInstance()->getTable('User')->hasColumn('field2')); // now migrate back to original version $migration->migrate(0); diff --git a/tests/migration_classes/001_add_table.php b/tests/migration_classes/001_add_table.php index c13464e84..7addb8ec3 100644 --- a/tests/migration_classes/001_add_table.php +++ b/tests/migration_classes/001_add_table.php @@ -1,13 +1,14 @@ -createTable('migration_test', array('field1' => array('type' => 'string'))); - } - - public function down() - { - $this->dropTable('migration_test'); - } +createTable('migration_test', array('field1' => array('type' => 'string'))); + $this->addColumn('migration_test', 'field2', 'integer'); + } + + public function down() + { + $this->dropTable('migration_test'); + } } \ No newline at end of file