@@ -50,7 +50,22 @@ public function test_migration_generate()
5050 $ migration_path = __DIR__ . '/../Fake/migrations/ ' ;
5151 $ this ->ci ->config ->set_item ('migration_path ' , $ migration_path );
5252 $ status = $ this ->cmd ->__invoke ('migration ' , 'Test_of_generate_migration ' );
53- $ this ->assertEquals (0 , $ status );
53+ $ this ->assertEquals (Status::SUCCESS , $ status );
54+
55+ foreach (glob ($ migration_path . '*_Test_of_generate_migration.php ' ) as $ file ) {
56+ unlink ($ file );
57+ }
58+ }
59+
60+ public function test_migration_generate_class_exist ()
61+ {
62+ $ migration_path = __DIR__ . '/../Fake/migrations/ ' ;
63+ $ this ->ci ->config ->set_item ('migration_path ' , $ migration_path );
64+ $ status = $ this ->cmd ->__invoke ('migration ' , 'Test_of_generate_migration ' );
65+ $ status = $ this ->cmd ->__invoke ('migration ' , 'Test_of_generate_migration ' );
66+ $ this ->assertEquals (Status::FAILURE , $ status );
67+ $ status = $ this ->cmd ->__invoke ('migration ' , 'Test_of_Generate_Migration ' );
68+ $ this ->assertEquals (Status::FAILURE , $ status );
5469
5570 foreach (glob ($ migration_path . '*_Test_of_generate_migration.php ' ) as $ file ) {
5671 unlink ($ file );
@@ -63,7 +78,7 @@ public function test_migration_cannot_write_to_file()
6378 $ this ->ci ->config ->set_item ('migration_path ' , $ migration_path );
6479 $ status = $ this ->cmd ->__invoke ('migration ' , 'Test_of_generate_migration ' );
6580 $ this ->assertEquals (Status::FAILURE , $ status );
66-
81+
6782 $ this ->stderr ->rewind ();
6883 $ actual = $ this ->stderr ->fread (8192 );
6984 $ this ->assertContains ("Can't write to " , $ actual );
0 commit comments