[Pkg-owncloud-commits] [owncloud] 156/165: add unit tests for null handling in view

David Prévot taffit at moszumanska.debian.org
Thu Apr 23 04:06:58 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 e302213248b2a6122fb7c5a72a61d5c37a1f313a
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Apr 22 16:24:25 2015 +0200

    add unit tests for null handling in view
---
 tests/lib/files/view.php | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 269b8b2..6bc6355 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -30,7 +30,7 @@ class TemporaryNoCross extends \OC\Files\Storage\Temporary {
 
 class TemporaryNoLocal extends \OC\Files\Storage\Temporary {
 	public function instanceOfStorage($className) {
-		if($className === '\OC\Files\Storage\Local') {
+		if ($className === '\OC\Files\Storage\Local') {
 			return false;
 		} else {
 			return parent::instanceOfStorage($className);
@@ -952,7 +952,7 @@ class View extends \Test\TestCase {
 
 		$storage2->expects($this->any())
 			->method('fopen')
-			->will($this->returnCallback(function($path, $mode) use($storage2) {
+			->will($this->returnCallback(function ($path, $mode) use ($storage2) {
 				$source = fopen($storage2->getSourcePath($path), $mode);
 				return \OC\Files\Stream\Quota::wrap($source, 9);
 			}));
@@ -1063,4 +1063,21 @@ class View extends \Test\TestCase {
 		$watcher = $storage->getWatcher();
 		$this->assertEquals(Watcher::CHECK_NEVER, $watcher->getPolicy());
 	}
+
+	public function testGetAbsolutePathOnNull() {
+		$view = new \OC\Files\View();
+		$this->assertNull($view->getAbsolutePath(null));
+	}
+
+	public function testGetRelativePathOnNull() {
+		$view = new \OC\Files\View();
+		$this->assertNull($view->getRelativePath(null));
+	}
+
+	/**
+	 * @expectedException \InvalidArgumentException
+	 */
+	public function testNullAsRoot() {
+		new \OC\Files\View(null);
+	}
 }

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