diff --git a/migrations/minion/20110110093709_create-test-minion-migrations-table.php b/migrations/minion/20110110093709_create-test-minion-migrations-table.php deleted file mode 100644 index d9982a7..0000000 --- a/migrations/minion/20110110093709_create-test-minion-migrations-table.php +++ /dev/null @@ -1,34 +0,0 @@ -query(NULL, 'CREATE TABLE `test_minion_migrations` ( - `timestamp` varchar(14) NOT NULL, - `description` varchar(100) NOT NULL, - `location` varchar(100) NOT NULL, - `applied` tinyint(1) DEFAULT \'0\', - PRIMARY KEY (`timestamp`,`location`), - UNIQUE KEY `MIGRATION_ID` (`timestamp`,`description`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1;'); - } - - /** - * Run queries needed to remove this migration - * - * @param Kohana_Database Database connection - */ - public function down(Kohana_Database $db) - { - $db->query(NULL, 'DROP TABLE `test_minion_migrations`'); - } -} diff --git a/tests/minion/migration/model.php b/tests/minion/migration/model.php index 7e7bdbe..73b838b 100644 --- a/tests/minion/migration/model.php +++ b/tests/minion/migration/model.php @@ -4,9 +4,33 @@ * Test for the migration model * * @group minion - **/ + * @group minion.tasks + * @group minion.tasks.migrations + */ class Minion_Migration_ModelTest extends Kohana_Unittest_Database_TestCase { + /** + * Runs before the test class as a whole is ran + * Creates the test table + */ + public static function setUpBeforeClass() + { + $sql = file_get_contents(Kohana::find_file('', 'minion_schema', 'sql')); + + $sql = str_replace('`minion_migrations`', '`test_minion_migrations`', $sql); + + Database::instance()->query(NULL, 'DROP TABLE IF EXISTS `test_minion_migrations`'); + Database::instance()->query(NULL, $sql); + } + + /** + * Removes the test tables after the tests have finished + */ + public static function tearDownAfterClass() + { + Database::instance()->query(NULL, 'DROP TABLE `test_minion_migrations`'); + } + /** * Gets the dataset that should be used to populate db *