diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-05-20 14:44:01 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-05-20 14:44:01 +0200 |
commit | 39d1e99228a22e232795b9800503697b866f5023 (patch) | |
tree | 01e67900bdec53eec9a6cc2ac201a35accd015da /tests | |
parent | 1a67e5cdc3242433225b6b8c08b7664f47c78255 (diff) | |
parent | 2213d6597c5d052acc27e294227a10d23ba00448 (diff) | |
download | nextcloud-server-39d1e99228a22e232795b9800503697b866f5023.tar.gz nextcloud-server-39d1e99228a22e232795b9800503697b866f5023.zip |
Merge pull request #16322 from owncloud/trash-view
dont go trough the view when moving to trash
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/storage/storage.php | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php index 938fecb5bf3..e8602b6b24a 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/files/storage/storage.php @@ -176,7 +176,7 @@ abstract class Storage extends \Test\TestCase { ]; } - public function initSourceAndTarget ($source, $target = null) { + public function initSourceAndTarget($source, $target = null) { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $this->instance->file_put_contents($source, file_get_contents($textFile)); if ($target) { @@ -185,12 +185,12 @@ abstract class Storage extends \Test\TestCase { } } - public function assertSameAsLorem ($file) { + public function assertSameAsLorem($file) { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $this->assertEquals( file_get_contents($textFile), $this->instance->file_get_contents($file), - 'Expected '.$file.' to be a copy of '.$textFile + 'Expected ' . $file . ' to be a copy of ' . $textFile ); } @@ -202,9 +202,9 @@ abstract class Storage extends \Test\TestCase { $this->instance->copy($source, $target); - $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); + $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); $this->assertSameAsLorem($target); - $this->assertTrue($this->instance->file_exists($source), $source.' was deleted'); + $this->assertTrue($this->instance->file_exists($source), $source . ' was deleted'); } /** @@ -216,8 +216,8 @@ abstract class Storage extends \Test\TestCase { $this->instance->rename($source, $target); $this->wait(); - $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); - $this->assertFalse($this->instance->file_exists($source), $source.' still exists'); + $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); + $this->assertFalse($this->instance->file_exists($source), $source . ' still exists'); $this->assertSameAsLorem($target); } @@ -225,12 +225,12 @@ abstract class Storage extends \Test\TestCase { * @dataProvider copyAndMoveProvider */ public function testCopyOverwrite($source, $target) { - $this->initSourceAndTarget($source,$target); + $this->initSourceAndTarget($source, $target); $this->instance->copy($source, $target); - $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); - $this->assertTrue($this->instance->file_exists($source), $source.' was deleted'); + $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); + $this->assertTrue($this->instance->file_exists($source), $source . ' was deleted'); $this->assertSameAsLorem($target); $this->assertSameAsLorem($source); } @@ -243,8 +243,8 @@ abstract class Storage extends \Test\TestCase { $this->instance->rename($source, $target); - $this->assertTrue($this->instance->file_exists($target), $target.' was not created'); - $this->assertFalse($this->instance->file_exists($source), $source.' still exists'); + $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); + $this->assertFalse($this->instance->file_exists($source), $source . ' still exists'); $this->assertSameAsLorem($target); } @@ -535,4 +535,17 @@ abstract class Storage extends \Test\TestCase { $this->assertTrue($this->instance->instanceOfStorage(get_class($this->instance))); $this->assertFalse($this->instance->instanceOfStorage('\OC')); } + + /** + * @dataProvider copyAndMoveProvider + */ + public function testCopyFromSameStorage($source, $target) { + $this->initSourceAndTarget($source); + + $this->instance->copyFromStorage($this->instance, $source, $target); + + $this->assertTrue($this->instance->file_exists($target), $target . ' was not created'); + $this->assertSameAsLorem($target); + $this->assertTrue($this->instance->file_exists($source), $source . ' was deleted'); + } } |