diff options
Diffstat (limited to 'tests/FilesTest.php')
-rw-r--r-- | tests/FilesTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/FilesTest.php b/tests/FilesTest.php new file mode 100644 index 0000000..7ab66fe --- /dev/null +++ b/tests/FilesTest.php @@ -0,0 +1,33 @@ +<?php + +namespace Wcms\Tests; + +use PHPUnit\Framework\TestCase; + +/** + * This abstract test class adds 3 usefull variables for files tests: + * - $this->testdir + * - $this->notwritabledir + * - $this->notwritablefile + */ +abstract class FilesTest extends TestCase +{ + protected $testdir = 'build/test'; + protected $notwritabledir = 'build/test/notwritabledir'; + protected $notwritablefile = 'build/test/notwritablefile'; + + protected function setUp(): void + { + parent::setUp(); + if (!is_dir($this->testdir)) { + mkdir($this->testdir, 0755, true); + } + if (!file_exists($this->notwritabledir)) { + mkdir($this->notwritabledir, 0000); + } + if (!file_exists($this->notwritablefile)) { + touch($this->notwritablefile); + chmod($this->notwritablefile, 0000); + } + } +} |