From 818e2a364a6ff3eae0e463fb117e6f17166b3dd1 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 3 Jul 2013 18:38:34 +0200 Subject: [PATCH] test moving and copying of subdirectories --- tests/lib/files/storage/storage.php | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php index 771fad8c61..b694a76ddf 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/files/storage/storage.php @@ -197,6 +197,47 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertTrue($this->instance->file_exists('/target2.txt')); $this->assertFalse($this->instance->file_exists('/source.txt')); $this->assertEquals(file_get_contents($textFile), $this->instance->file_get_contents('/target.txt')); + + $this->assertTrue($this->instance->mkdir('/folder')); + $this->assertTrue($this->instance->mkdir('/folder/sub_a')); + $this->assertTrue($this->instance->mkdir('/folder/sub_b')); + $this->assertTrue($this->instance->mkdir('/folder/sub_b/sub_bb')); + + $this->assertTrue($this->instance->rename('/folder/sub_b', '/folder/sub_c')); + $this->assertTrue($this->instance->is_dir('/folder/sub_c')); + $this->assertTrue($this->instance->is_dir('/folder/sub_c/sub_bb')); + $this->assertFalse($this->instance->is_dir('/folder/sub_b')); + $this->assertFalse($this->instance->is_dir('/folder/sub_b/sub_bb')); + + $this->assertTrue($this->instance->rename('/folder', '/folder_b')); + $this->assertTrue($this->instance->is_dir('/folder_b')); + $this->assertTrue($this->instance->is_dir('/folder_b/sub_c')); + $this->assertTrue($this->instance->is_dir('/folder_b/sub_c/sub_bb')); + $this->assertFalse($this->instance->is_dir('/folder')); + $this->assertFalse($this->instance->is_dir('/folder/sub_c')); + $this->assertFalse($this->instance->is_dir('/folder/sub_c/sub_bb')); + + $this->assertTrue($this->instance->copy('/folder_b', '/folder')); + $this->assertTrue($this->instance->is_dir('/folder_b')); + $this->assertTrue($this->instance->is_dir('/folder_b/sub_c')); + $this->assertTrue($this->instance->is_dir('/folder_b/sub_c/sub_bb')); + $this->assertTrue($this->instance->is_dir('/folder')); + $this->assertTrue($this->instance->is_dir('/folder/sub_c')); + $this->assertTrue($this->instance->is_dir('/folder/sub_c/sub_bb')); + + $this->assertTrue($this->instance->copy('/folder/sub_c', '/folder/sub_b')); + $this->assertTrue($this->instance->is_dir('/folder/sub_b')); + $this->assertTrue($this->instance->is_dir('/folder/sub_b/sub_bb')); + $this->assertTrue($this->instance->is_dir('/folder/sub_c')); + $this->assertTrue($this->instance->is_dir('/folder/sub_c/sub_bb')); + + $this->assertTrue($this->instance->rmdir('/folder')); + $this->assertFalse($this->instance->is_dir('/folder')); + $this->assertFalse($this->instance->is_dir('/folder/sub_a')); + $this->assertFalse($this->instance->is_dir('/folder/sub_b')); + $this->assertFalse($this->instance->is_dir('/folder/sub_c')); + $this->assertFalse($this->instance->is_dir('/folder/sub_b/sub_bb')); + $this->assertFalse($this->instance->is_dir('/folder/sub_c/sub_bb')); } public function testLocal() {