| 1 | <?php |
||
| 3 | abstract class FileSystemTest extends PHPUnit_Framework_TestCase |
||
| 4 | { |
||
| 5 | |||
| 6 | protected $path = __DIR__ . '/temp'; |
||
| 7 | |||
| 8 | protected function createTempFolder() |
||
| 9 | { |
||
| 10 | mkdir($this->path, 0700, true); |
||
| 11 | } |
||
| 12 | |||
| 13 | protected function removeTempFolder() |
||
| 14 | { |
||
| 15 | if (file_exists($this->path)) { |
||
| 16 | array_map('unlink', glob($this->path . '/' . '{,.}[!.,!..]*',GLOB_MARK|GLOB_BRACE)); |
||
| 17 | rmdir($this->path); |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | public function setup() |
||
| 22 | { |
||
| 23 | parent::setup(); |
||
| 24 | $this->removeTempFolder(); |
||
| 25 | $this->createTempFolder(); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function teardown() |
||
| 29 | { |
||
| 30 | parent::teardown(); |
||
| 31 | $this->removeTempFolder(); |
||
| 32 | } |
||
| 33 | } |
||
| 34 |