aboutsummaryrefslogtreecommitdiff
path: root/tests/FilesTest.php
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2020-04-21 11:31:27 +0200
committerVincent Peugnet <33429034+vincent-peugnet@users.noreply.github.com>2020-04-21 14:56:53 +0200
commit6984e737b706c73baaa5c3c921762706f958d4da (patch)
tree20858ee13c9b5e8cfffae2090904e051b2f874b7 /tests/FilesTest.php
parent3355532be69a1c11a0637b1dfc994748b5de558f (diff)
downloadwcms-6984e737b706c73baaa5c3c921762706f958d4da.tar.gz
wcms-6984e737b706c73baaa5c3c921762706f958d4da.zip
feat: Logger throws Exceptions instead of die
added FilesTests for future files related tests
Diffstat (limited to 'tests/FilesTest.php')
-rw-r--r--tests/FilesTest.php33
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);
+ }
+ }
+}