diff --git a/test/Mustache/Test/Cache/FilesystemCacheTest.php b/test/Mustache/Test/Cache/FilesystemCacheTest.php index e19c33b..5bfb18c 100644 --- a/test/Mustache/Test/Cache/FilesystemCacheTest.php +++ b/test/Mustache/Test/Cache/FilesystemCacheTest.php @@ -12,18 +12,8 @@ /** * @group functional */ -class Mustache_Test_Cache_FilesystemCacheTest extends PHPUnit_Framework_TestCase +class Mustache_Test_Cache_FilesystemCacheTest extends Mustache_Test_FunctionalTestCase { - private static $tempDir; - - public static function setUpBeforeClass() - { - self::$tempDir = sys_get_temp_dir() . '/mustache_test'; - if (file_exists(self::$tempDir)) { - self::rmdir(self::$tempDir); - } - } - public function testCacheGetNone() { $key = 'some key'; @@ -43,28 +33,4 @@ class Mustache_Test_Cache_FilesystemCacheTest extends PHPUnit_Framework_TestCase $this->assertTrue($loaded); } - - /** - * @param string $path - */ - private static function rmdir($path) - { - $path = rtrim($path, '/').'/'; - $handle = opendir($path); - while (($file = readdir($handle)) !== false) { - if ($file == '.' || $file == '..') { - continue; - } - - $fullpath = $path.$file; - if (is_dir($fullpath)) { - self::rmdir($fullpath); - } else { - unlink($fullpath); - } - } - - closedir($handle); - rmdir($path); - } } diff --git a/test/Mustache/Test/EngineTest.php b/test/Mustache/Test/EngineTest.php index af3fe1e..faeed29 100644 --- a/test/Mustache/Test/EngineTest.php +++ b/test/Mustache/Test/EngineTest.php @@ -12,19 +12,8 @@ /** * @group unit */ -class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase +class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase { - - private static $tempDir; - - public static function setUpBeforeClass() - { - self::$tempDir = sys_get_temp_dir() . '/mustache_test'; - if (file_exists(self::$tempDir)) { - self::rmdir(self::$tempDir); - } - } - public function testConstructor() { $logger = new Mustache_Logger_StreamLogger(tmpfile()); @@ -348,30 +337,6 @@ class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase $this->assertContains("DEBUG: Instantiating template: ", $log); $this->assertContains("WARNING: Partial not found: \"bar\"", $log); } - - /** - * @param string $path - */ - private static function rmdir($path) - { - $path = rtrim($path, '/').'/'; - $handle = opendir($path); - while (($file = readdir($handle)) !== false) { - if ($file == '.' || $file == '..') { - continue; - } - - $fullpath = $path.$file; - if (is_dir($fullpath)) { - self::rmdir($fullpath); - } else { - unlink($fullpath); - } - } - - closedir($handle); - rmdir($path); - } } class MustacheStub extends Mustache_Engine diff --git a/test/Mustache/Test/FunctionalTestCase.php b/test/Mustache/Test/FunctionalTestCase.php new file mode 100644 index 0000000..73cfa9c --- /dev/null +++ b/test/Mustache/Test/FunctionalTestCase.php @@ -0,0 +1,47 @@ +