diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-23 16:48:25 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-23 16:48:25 +0200 |
commit | 0ab66d9b48b2d7d99afacd2c303fb09a6984cc56 (patch) | |
tree | 32fdb8b38ca88d227a6ca75b255fcbeec76df328 /tests | |
parent | ed31f30afd481014612fa88be17e7450b20e562b (diff) | |
download | nextcloud-server-0ab66d9b48b2d7d99afacd2c303fb09a6984cc56.tar.gz nextcloud-server-0ab66d9b48b2d7d99afacd2c303fb09a6984cc56.zip |
Added unit test for the helper's rmdirr
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/helper.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/helper.php b/tests/lib/helper.php index cfd66e99704..20b8571b91d 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)); + } } |