Sfoglia il codice sorgente

Clean temp files MigratorTest (#4177)

The automated tests used to generate several temporary files not deleted...
Alexandre Alapetite 4 anni fa
parent
commit
24afafb74d
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      tests/lib/Minz/MigratorTest.php

+ 5 - 0
tests/lib/Minz/MigratorTest.php

@@ -268,6 +268,7 @@ class MigratorTest extends TestCase
 		$this->assertTrue($result);
 		$this->assertTrue($result);
 		$versions = file_get_contents($applied_migrations_path);
 		$versions = file_get_contents($applied_migrations_path);
 		$this->assertSame("2019_12_22_FooBar\n2019_12_23_Baz", $versions);
 		$this->assertSame("2019_12_22_FooBar\n2019_12_23_Baz", $versions);
+		@unlink($applied_migrations_path);
 	}
 	}
 
 
 	public function testExecuteWithAlreadyAppliedMigration() {
 	public function testExecuteWithAlreadyAppliedMigration() {
@@ -280,6 +281,7 @@ class MigratorTest extends TestCase
 		$this->assertTrue($result);
 		$this->assertTrue($result);
 		$versions = file_get_contents($applied_migrations_path);
 		$versions = file_get_contents($applied_migrations_path);
 		$this->assertSame("2019_12_22_FooBar\n2019_12_23_Baz", $versions);
 		$this->assertSame("2019_12_22_FooBar\n2019_12_23_Baz", $versions);
+		@unlink($applied_migrations_path);
 	}
 	}
 
 
 	public function testExecuteWithAppliedMigrationInDifferentOrder() {
 	public function testExecuteWithAppliedMigrationInDifferentOrder() {
@@ -294,6 +296,7 @@ class MigratorTest extends TestCase
 		// if the order changes, it probably means the first versions comparison
 		// if the order changes, it probably means the first versions comparison
 		// test doesn't work anymore
 		// test doesn't work anymore
 		$this->assertSame("2019_12_23_Baz\n2019_12_22_FooBar", $versions);
 		$this->assertSame("2019_12_23_Baz\n2019_12_22_FooBar", $versions);
+		@unlink($applied_migrations_path);
 	}
 	}
 
 
 	public function testExecuteFailsIfVersionPathDoesNotExist() {
 	public function testExecuteFailsIfVersionPathDoesNotExist() {
@@ -305,6 +308,7 @@ class MigratorTest extends TestCase
 		$result = Minz_Migrator::execute($migrations_path, $applied_migrations_path);
 		$result = Minz_Migrator::execute($migrations_path, $applied_migrations_path);
 
 
 		$this->assertSame($expected_result, $result);
 		$this->assertSame($expected_result, $result);
+		@unlink($applied_migrations_path);
 	}
 	}
 
 
 	public function testExecuteFailsIfAMigrationIsFailing() {
 	public function testExecuteFailsIfAMigrationIsFailing() {
@@ -318,5 +322,6 @@ class MigratorTest extends TestCase
 		$this->assertSame($expected_result, $result);
 		$this->assertSame($expected_result, $result);
 		$versions = file_get_contents($applied_migrations_path);
 		$versions = file_get_contents($applied_migrations_path);
 		$this->assertSame('2020_01_11_FooBar', $versions);
 		$this->assertSame('2020_01_11_FooBar', $versions);
+		@unlink($applied_migrations_path);
 	}
 	}
 }
 }