summaryrefslogtreecommitdiffstats
path: root/application/test
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-07-31 19:34:58 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-07-31 19:34:58 +0200
commit3feb2a388e490f03779ee90b799fdd7923d1d157 (patch)
tree2e63ad0c641448b8f5c9f88d9730716a6c8f0d60 /application/test
parentcac7ae9fc539cb09db7e22c7578c4d6a06f29398 (diff)
Test \libraries\Tempfile
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/test')
-rw-r--r--application/test/tests/test_libraries_tempfile.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/application/test/tests/test_libraries_tempfile.php b/application/test/tests/test_libraries_tempfile.php
new file mode 100644
index 000000000..f4c10a22e
--- /dev/null
+++ b/application/test/tests/test_libraries_tempfile.php
@@ -0,0 +1,46 @@
+<?php
+/*
+ * Copyright 2015 Florian "Bluewind" Pritz <bluewind@server-speed.net>
+ *
+ * Licensed under AGPLv3
+ * (see COPYING for full license text)
+ *
+ */
+
+namespace test\tests;
+
+class test_libraries_tempfile extends \test\Test {
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+ public function init()
+ {
+ }
+
+ public function cleanup()
+ {
+ }
+
+ public function test_destructor_normalCase()
+ {
+ $t = new \libraries\Tempfile();
+ $file = $t->get_file();
+ $this->t->is(file_exists($file), true, "file should exist");
+ unset($t);
+ $this->t->is(file_exists($file), false, "file should no longer exist after destruction of object");
+ }
+
+ public function test_destructor_alreadyRemoved()
+ {
+ $t = new \libraries\Tempfile();
+ $file = $t->get_file();
+ $this->t->is(file_exists($file), true, "file should exist");
+ unlink($file);
+ $this->t->is(file_exists($file), false, "file deleted");
+ unset($t);
+ $this->t->is(file_exists($file), false, "file should no longer exist after destruction of object");
+ }
+}