[Pkg-owncloud-commits] [owncloud] 24/67: Added unit test for the helper's rmdirr
David Prévot
taffit at moszumanska.debian.org
Fri Jun 27 23:58:14 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 0ab66d9b48b2d7d99afacd2c303fb09a6984cc56
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Mon Jun 23 16:48:25 2014 +0200
Added unit test for the helper's rmdirr
---
tests/lib/helper.php | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tests/lib/helper.php b/tests/lib/helper.php
index cfd66e9..20b8571 100644
--- a/tests/lib/helper.php
+++ b/tests/lib/helper.php
@@ -454,4 +454,28 @@ class Test_Helper extends PHPUnit_Framework_TestCase {
$this->assertEquals('http://localhost/owncloud/public.php?service=files', $result);
}
+ /**
+ * Tests recursive folder deletion with rmdirr()
+ */
+ public function testRecursiveFolderDeletion() {
+ $baseDir = \OC_Helper::tmpFolder() . '/';
+ mkdir($baseDir . 'a/b/c/d/e', 0777, true);
+ mkdir($baseDir . 'a/b/c1/d/e', 0777, true);
+ mkdir($baseDir . 'a/b/c2/d/e', 0777, true);
+ mkdir($baseDir . 'a/b1/c1/d/e', 0777, true);
+ mkdir($baseDir . 'a/b2/c1/d/e', 0777, true);
+ mkdir($baseDir . 'a/b3/c1/d/e', 0777, true);
+ mkdir($baseDir . 'a1/b', 0777, true);
+ mkdir($baseDir . 'a1/c', 0777, true);
+ file_put_contents($baseDir . 'a/test.txt', 'Hello file!');
+ file_put_contents($baseDir . 'a/b1/c1/test one.txt', 'Hello file one!');
+ file_put_contents($baseDir . 'a1/b/test two.txt', 'Hello file two!');
+ \OC_Helper::rmdirr($baseDir . 'a');
+
+ $this->assertFalse(file_exists($baseDir . 'a'));
+ $this->assertTrue(file_exists($baseDir . 'a1'));
+
+ \OC_Helper::rmdirr($baseDir);
+ $this->assertFalse(file_exists($baseDir));
+ }
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list