public function testExecuteWithoutTableSchema() { $this->_adapter->setTableSchemaExist(false); $actual = $this->object->execute(array()); $regexp = '/^Started: \\d{4}-\\d{2}-\\d{2} \\d{1,2}:\\d{2}(am|pm) \\w{3,4}\\012+' . "\\[db:setup\\]: \n+\t+Creating table: 'schema_migrations'" . '\\012+\\t+Done\\.\\012+Finished: ' . '\\d{4}-\\d{2}-\\d{2} \\d{1,2}:\\d{2}(am|pm) \\w{3,4}\\012+$/'; $this->assertNotEmpty($actual); $this->assertRegExp($regexp, $actual); }
public function testExecuteWithOneVersionMoreInTableSchema() { $this->_adapter->setTableSchemaExist(true); $this->_adapter->versions = array(array('version' => '20120109064438'), array('version' => '20120110064438'), array('version' => '20120111064438'), array('version' => '20130112064438')); $regexp = '/^Started: \\d{4}-\\d{2}-\\d{2} \\d{1,2}:\\d{2}(am|pm) \\w{3,4}\\012+' . '\\[db:status\\]:\\012+' . '=+ APPLIED =+\\012+' . "\t\\[40m\\[1;32mCreateUsers \\[ 20120109064438 \\]\\[40m\\[1;35m \\([\\w ]{0,50}\\.\\.\\.\\)\\[0m\n+" . "\t\\[40m\\[1;32mAddIndexToUsers \\[ 20120110064438 \\]\\[0m\n+" . "\t\\[40m\\[1;32mCreateAddresses \\[ 20120111064438 \\]\\[40m\\[1;35m \\([\\w ]{0,50}\\)\\[0m\n+" . '=+ NOT APPLIED =+\\012+' . "\t\\[40m\\[1;33mMissingMethodUp \\[ 20120112064438 \\]\\[0m\n+" . '=+ APPLIED WITHOUT MIGRATION FILE =+\\012+' . "\t\\[40m\\[1;31m\\?\\?\\? \\[ 20130112064438 \\]\\[0m\n+" . '\\012+Finished: \\d{4}-\\d{2}-\\d{2} \\d{1,2}:\\d{2}(am|pm) \\w{3,4}\\012+$/'; $actual = $this->object->execute(array()); $this->assertNotEmpty($actual); $this->assertRegExp($regexp, $actual); }
public function testExecute() { $this->_adapter->setTableSchemaExist(true); $this->object->setDirectoryOfMigrations('/tmp'); $expected = FIXTURES_PATH . '/db/schema.txt'; $actual = $this->object->execute(array()); $this->assertFileExists('/tmp/schema.txt'); $this->assertFileEquals($expected, '/tmp/schema.txt'); }