summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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");
+ }
+}