Browse Source

Clean up temp files after a test.

Vyacheslav Pavlov 8 years ago
parent
commit
108560b9c4
1 changed files with 7 additions and 4 deletions
  1. 7 4
      tests/Composer/Test/Autoload/ClassMapGeneratorTest.php

+ 7 - 4
tests/Composer/Test/Autoload/ClassMapGeneratorTest.php

@@ -220,16 +220,19 @@ class ClassMapGeneratorTest extends TestCase
 
     public function testDump()
     {
-        $dir = self::getUniqueTmpDirectory();
+        $tempDir = self::getUniqueTmpDirectory();
 
-        $resultFile = 'result.txt';
-        $fileInDirectory = $dir . '/TestClass.php';
+        $resultFile = $tempDir . '/result.txt';
+        $fileInDirectory = $tempDir . '/TestClass.php';
 
         file_put_contents($fileInDirectory, "<?php class TestClass {} ?>");
 
-        ClassMapGenerator::dump(array($dir), $resultFile);
+        ClassMapGenerator::dump(array($tempDir), $resultFile);
 
         $this->assertEquals("<?php return array (\n  'TestClass' => '$fileInDirectory',\n);", file_get_contents($resultFile));
+
+        $fs = new Filesystem();
+        $fs->removeDirectory($tempDir);
     }
 
     protected function assertEqualsNormalized($expected, $actual, $message = null)