From 3feb2a388e490f03779ee90b799fdd7923d1d157 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 31 Jul 2016 19:34:58 +0200 Subject: Test \libraries\Tempfile Signed-off-by: Florian Pritz --- application/test/tests/test_libraries_tempfile.php | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 application/test/tests/test_libraries_tempfile.php 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 @@ + + * + * 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"); + } +} -- cgit v1.2.3-24-g4f1b