@@ -9,24 +9,24 @@ class MigrateTest extends PHPUnit_Framework_TestCase
99 private static $ db ;
1010 private static $ dbName ;
1111 private static $ migrationPath ;
12- private static $ changelog ;
12+ private static $ changelog = ' versionning ' ;
1313
1414 public static function setUpBeforeClass () {
1515 self ::$ dbName = dirname (__FILE__ ) . '/test.sqlite ' ;
1616 unlink (self ::$ dbName );
17-
18- self ::$ changelog = 'mychangelog ' ;
1917
2018 self ::$ db = new PDO ('sqlite: ' . self ::$ dbName , '' , '' );
2119 self ::$ db ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
22- self ::$ db ->exec ("create table " .self ::$ changelog ." (
20+ self ::$ db ->exec ("create table " . self ::$ changelog . " (
2321 id numeric(20,0),
2422 applied_at character varying(25),
2523 version character varying(25),
2624 description character varying(255)
2725 ) " );
2826
2927 self ::$ migrationPath = realpath (dirname (__FILE__ )) . "/../migrations " ;
28+
29+ exec ('rm ' . self ::$ migrationPath . '/* ' );
3030 }
3131
3232 public function setUp () {
@@ -59,9 +59,9 @@ public function testGetLocaleList() {
5959 * @Test
6060 */
6161 public function testGetDbList () {
62- self ::$ db ->query ("INSERT INTO " .self ::$ changelog ." (id, applied_at, description) VALUES (20100101, '2010-01-01', 'description 1') " );
63- self ::$ db ->query ("INSERT INTO " .self ::$ changelog ." (id, applied_at, description) VALUES (20100102, '2010-01-02', 'description 2') " );
64- self ::$ db ->query ("INSERT INTO " .self ::$ changelog ." (id, applied_at, description) VALUES (20100103, '2010-01-03', 'description 3') " );
62+ self ::$ db ->query ("INSERT INTO " . self ::$ changelog . " (id, applied_at, description) VALUES (20100101, '2010-01-01', 'description 1') " );
63+ self ::$ db ->query ("INSERT INTO " . self ::$ changelog . " (id, applied_at, description) VALUES (20100102, '2010-01-02', 'description 2') " );
64+ self ::$ db ->query ("INSERT INTO " . self ::$ changelog . " (id, applied_at, description) VALUES (20100103, '2010-01-03', 'description 3') " );
6565
6666 $ expected = array (
6767 '20100101 ' => new Migration ('20100101 ' , '2010-01-01 ' , 'description 1 ' , '20100101_description_1.sql ' , true ),
@@ -74,7 +74,7 @@ public function testGetDbList() {
7474
7575 $ migrationList = $ migrator ->getDbList ();
7676
77- self ::$ db ->query ("DELETE FROM " .self ::$ changelog );
77+ self ::$ db ->query ("DELETE FROM " . self ::$ changelog );
7878
7979 $ this ->assertEquals ($ expected , $ migrationList );
8080
@@ -93,10 +93,10 @@ public function testGetMigrationList() {
9393 touch (self ::$ migrationPath . "/20100104_description_2.sql " );
9494 touch (self ::$ migrationPath . "/20100105_description_3.sql " );
9595
96- self ::$ db ->query ("INSERT INTO " .self ::$ changelog ." (id, applied_at, description) VALUES (20100100, '2009-12-30', 'description 0') " );
97- self ::$ db ->query ("INSERT INTO " .self ::$ changelog ." (id, applied_at, description) VALUES (20100103, '2010-01-01', 'description 1') " );
98- self ::$ db ->query ("INSERT INTO " .self ::$ changelog ." (id, applied_at, description) VALUES (20100104, '2010-01-02', 'description 2') " );
99- self ::$ db ->query ("INSERT INTO " .self ::$ changelog ." (id, applied_at, description) VALUES (20100105, '2010-01-03', 'description 3') " );
96+ self ::$ db ->query ("INSERT INTO " . self ::$ changelog . " (id, applied_at, description) VALUES (20100100, '2009-12-30', 'description 0') " );
97+ self ::$ db ->query ("INSERT INTO " . self ::$ changelog . " (id, applied_at, description) VALUES (20100103, '2010-01-01', 'description 1') " );
98+ self ::$ db ->query ("INSERT INTO " . self ::$ changelog . " (id, applied_at, description) VALUES (20100104, '2010-01-02', 'description 2') " );
99+ self ::$ db ->query ("INSERT INTO " . self ::$ changelog . " (id, applied_at, description) VALUES (20100105, '2010-01-03', 'description 3') " );
100100
101101 $ expected = array (
102102 '20100100 ' => new Migration ('20100100 ' , '2009-12-30 ' , 'description 0 ' , '20100100_description_0.sql ' , true ),
@@ -111,7 +111,7 @@ public function testGetMigrationList() {
111111 $ migrator ->setDb (self ::$ db );
112112 $ migrationList = $ migrator ->getMigrationList ();
113113
114- self ::$ db ->query ("DELETE FROM " .self ::$ changelog );
114+ self ::$ db ->query ("DELETE FROM " . self ::$ changelog );
115115
116116 unlink (self ::$ migrationPath . "/20100101_add_table_1.sql " );
117117 unlink (self ::$ migrationPath . "/20100102_add_table_2.sql " );
@@ -172,6 +172,7 @@ public function testDoUpThenDown() {
172172SQL ;
173173
174174 file_put_contents (self ::$ migrationPath . "/ " . $ aMigration ->getSqlFile (), $ sqlUp1 );
175+
175176 }
176177
177178
@@ -500,7 +501,7 @@ public function testDoStatus() {
500501 $ migrator ->doUpForce ($ migrationList [4 ]->getId ());
501502
502503 $ status = $ migrator ->doStatus ();
503- print_r ($ status );
504+ // print_r($status);
504505
505506 foreach ($ migrationList as $ aMigration ) {
506507 /* @var $aMigration Migration */
0 commit comments