[Pkg-owncloud-commits] [owncloud] 78/457: add tests for copyFromStorage with same storage

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:05:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 2213d6597c5d052acc27e294227a10d23ba00448
Author: Robin Appelman <icewind at owncloud.com>
Date:   Tue May 19 17:30:32 2015 +0200

    add tests for copyFromStorage with same storage
---
 tests/lib/files/storage/storage.php | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 938fecb..e8602b6 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');
+	}
 }

-- 
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