diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-02-18 18:28:24 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-09 10:38:37 +0100 |
commit | 49e1a81eba45fe33e00c217758656cf9201ec0cd (patch) | |
tree | 8bf628e52c0003b67677a6fad49adbd01941492d /tests/lib | |
parent | 4bac595068c813c56d8d5e580e560527ba80194d (diff) | |
download | nextcloud-server-49e1a81eba45fe33e00c217758656cf9201ec0cd.tar.gz nextcloud-server-49e1a81eba45fe33e00c217758656cf9201ec0cd.zip |
fixing namespaces and PHPDoc
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/connector/sabre/directory.php | 2 | ||||
-rw-r--r-- | tests/lib/connector/sabre/exception/invalidpathtest.php | 11 | ||||
-rw-r--r-- | tests/lib/connector/sabre/file.php | 19 | ||||
-rw-r--r-- | tests/lib/connector/sabre/node.php | 3 | ||||
-rw-r--r-- | tests/lib/connector/sabre/objecttree.php | 22 |
5 files changed, 32 insertions, 25 deletions
diff --git a/tests/lib/connector/sabre/directory.php b/tests/lib/connector/sabre/directory.php index e7fbd1d27b6..2550f2bcef1 100644 --- a/tests/lib/connector/sabre/directory.php +++ b/tests/lib/connector/sabre/directory.php @@ -8,7 +8,9 @@ */ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase { + /** @var OC\Files\View | PHPUnit_Framework_MockObject_MockObject */ private $view; + /** @var OC\Files\FileInfo | PHPUnit_Framework_MockObject_MockObject */ private $info; protected function setUp() { diff --git a/tests/lib/connector/sabre/exception/invalidpathtest.php b/tests/lib/connector/sabre/exception/invalidpathtest.php index ee3da8c3886..d2d58887d62 100644 --- a/tests/lib/connector/sabre/exception/invalidpathtest.php +++ b/tests/lib/connector/sabre/exception/invalidpathtest.php @@ -1,12 +1,16 @@ <?php +namespace Test\Connector\Sabre\Exception; + +use OC\Connector\Sabre\Exception\InvalidPath; + /** * Copyright (c) 2015 Thomas Müller <deepdiver@owncloud.com> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ -class Test_OC_Connector_Sabre_Exception_InvalidPath extends \Test\TestCase { +class InvalidPathTest extends \Test\TestCase { public function testSerialization() { @@ -14,7 +18,7 @@ class Test_OC_Connector_Sabre_Exception_InvalidPath extends \Test\TestCase { $DOM = new \DOMDocument('1.0','utf-8'); $DOM->formatOutput = true; $error = $DOM->createElementNS('DAV:','d:error'); - $error->setAttribute('xmlns:s', Sabre\DAV\Server::NS_SABREDAV); + $error->setAttribute('xmlns:s', \Sabre\DAV\Server::NS_SABREDAV); $DOM->appendChild($error); // serialize the exception @@ -29,8 +33,7 @@ class Test_OC_Connector_Sabre_Exception_InvalidPath extends \Test\TestCase { EOD; - - $ex = new OC_Connector_Sabre_Exception_InvalidPath($message, $retry); + $ex = new InvalidPath($message, $retry); $server = $this->getMock('Sabre\DAV\Server'); $ex->serialize($server, $error); diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php index 2ef5fd794be..f2812e390ac 100644 --- a/tests/lib/connector/sabre/file.php +++ b/tests/lib/connector/sabre/file.php @@ -6,7 +6,12 @@ * See the COPYING-README file. */ -class Test_OC_Connector_Sabre_File extends \Test\TestCase { +namespace Test\Connector\Sabre; + + +use OC_Connector_Sabre_File; + +class File extends \Test\TestCase { /** * @expectedException \Sabre\DAV\Exception @@ -93,7 +98,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase { } /** - * @expectedException \Sabre\DAV\Exception\BadRequest + * @expectedException \OC\Connector\Sabre\Exception\InvalidPath */ public function testSimplePutInvalidChars() { // setup @@ -104,9 +109,9 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase { $view->expects($this->any()) ->method('getRelativePath') - ->will($this->returnValue('/super*star.txt')); + ->will($this->returnValue('/*')); - $info = new \OC\Files\FileInfo('/super*star.txt', null, null, array( + $info = new \OC\Files\FileInfo('/*', null, null, array( 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); $file = new \OC\Connector\Sabre\File($view, $info); @@ -117,7 +122,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase { /** * Test setting name with setName() with invalid chars - * @expectedException \Sabre\DAV\Exception\BadRequest + * @expectedException \OC\Connector\Sabre\Exception\InvalidPath */ public function testSetNameInvalidChars() { // setup @@ -125,9 +130,9 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase { $view->expects($this->any()) ->method('getRelativePath') - ->will($this->returnValue('/super*star.txt')); + ->will($this->returnValue('/*')); - $info = new \OC\Files\FileInfo('/super*star.txt', null, null, array( + $info = new \OC\Files\FileInfo('/*', null, null, array( 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); $file = new \OC\Connector\Sabre\File($view, $info); diff --git a/tests/lib/connector/sabre/node.php b/tests/lib/connector/sabre/node.php index e1ae05b2170..3b3a6107813 100644 --- a/tests/lib/connector/sabre/node.php +++ b/tests/lib/connector/sabre/node.php @@ -9,9 +9,6 @@ namespace Test\Connector\Sabre; -use OC\Files\FileInfo; -use OC\Files\View; - class Node extends \Test\TestCase { public function davPermissionsProvider() { return array( diff --git a/tests/lib/connector/sabre/objecttree.php b/tests/lib/connector/sabre/objecttree.php index 0709aa89c63..d2702027b0d 100644 --- a/tests/lib/connector/sabre/objecttree.php +++ b/tests/lib/connector/sabre/objecttree.php @@ -47,29 +47,29 @@ class ObjectTree extends \Test\TestCase { * @dataProvider moveFailedProvider * @expectedException \Sabre\DAV\Exception\Forbidden */ - public function testMoveFailed($source, $dest, $updatables, $deletables) { - $this->moveTest($source, $dest, $updatables, $deletables); + public function testMoveFailed($source, $destination, $updatables, $deletables) { + $this->moveTest($source, $destination, $updatables, $deletables); } /** * @dataProvider moveSuccessProvider */ - public function testMoveSuccess($source, $dest, $updatables, $deletables) { - $this->moveTest($source, $dest, $updatables, $deletables); + public function testMoveSuccess($source, $destination, $updatables, $deletables) { + $this->moveTest($source, $destination, $updatables, $deletables); $this->assertTrue(true); } /** * @dataProvider moveFailedInvalidCharsProvider - * @expectedException \Sabre\DAV\Exception\BadRequest + * @expectedException \OC\Connector\Sabre\Exception\InvalidPath */ - public function testMoveFailedInvalidChars($source, $dest, $updatables, $deletables) { - $this->moveTest($source, $dest, $updatables, $deletables); + public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables) { + $this->moveTest($source, $destination, $updatables, $deletables); } function moveFailedInvalidCharsProvider() { return array( - array('a/b', 'a/c*', array('a' => false, 'a/b' => true, 'a/c*' => false), array()), + array('a/b', 'a/*', array('a' => false, 'a/b' => true, 'a/c*' => false), array()), ); } @@ -94,10 +94,10 @@ class ObjectTree extends \Test\TestCase { /** * @param $source - * @param $dest + * @param $destination * @param $updatables */ - private function moveTest($source, $dest, $updatables, $deletables) { + private function moveTest($source, $destination, $updatables, $deletables) { $view = new TestDoubleFileView($updatables, $deletables); $info = new FileInfo('', null, null, array(), null); @@ -115,7 +115,7 @@ class ObjectTree extends \Test\TestCase { /** @var $objectTree \OC\Connector\Sabre\ObjectTree */ $mountManager = \OC\Files\Filesystem::getMountManager(); $objectTree->init($rootDir, $view, $mountManager); - $objectTree->move($source, $dest); + $objectTree->move($source, $destination); } /** |