]> source.dussan.org Git - nextcloud-server.git/commitdiff
return null instead of throwing an exception
authorRobin Appelman <icewind@owncloud.com>
Wed, 6 Aug 2014 10:06:41 +0000 (12:06 +0200)
committerRobin Appelman <icewind@owncloud.com>
Thu, 7 Aug 2014 11:42:25 +0000 (13:42 +0200)
lib/private/files/node/folder.php
tests/lib/files/node/folder.php

index f5211d5d748a2e2f22c133254cb82b75ea310d9c..8c7acc339ae1127b94c5ca9ffd5a9988919c244e 100644 (file)
@@ -27,7 +27,6 @@ class Folder extends Node implements \OCP\Files\Folder {
 
        /**
         * @param string $path
-        * @throws \OCP\Files\NotFoundException
         * @return string
         */
        public function getRelativePath($path) {
@@ -37,7 +36,7 @@ class Folder extends Node implements \OCP\Files\Folder {
                if ($path === $this->path) {
                        return '/';
                } else if (strpos($path, $this->path . '/') !== 0) {
-                       throw new NotFoundException();
+                       return null;
                } else {
                        $path = substr($path, strlen($this->path));
                        return $this->normalizePath($path);
index bd9c2890cf0745ee0ba035b56dbb7e2cbc04ad64..436161aba72fab9a8c26b1d4a40434b8f03dfcbd 100644 (file)
@@ -513,9 +513,6 @@ class Folder extends \PHPUnit_Framework_TestCase {
                $this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
        }
 
-       /**
-        * @expectedException \OCP\Files\NotFoundException
-        */
        public function testGetByIdOutsideFolder() {
                $manager = $this->getMock('\OC\Files\Mount\Manager');
                /**
@@ -550,7 +547,8 @@ class Folder extends \PHPUnit_Framework_TestCase {
                        ->will($this->returnValue($mount));
 
                $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
-               $node->getById(1);
+               $result = $node->getById(1);
+               $this->assertCount(0, $result);
        }
 
        public function testGetByIdMultipleStorages() {