diff options
Diffstat (limited to 'tests/lib/Files/Node/NodeTest.php')
-rw-r--r-- | tests/lib/Files/Node/NodeTest.php | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php index 566c84e2c85..7c8ddee6b5f 100644 --- a/tests/lib/Files/Node/NodeTest.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -43,7 +43,7 @@ abstract class NodeTest extends \Test\TestCase { /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */ protected $userManager; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->user = $this->createMock(IUser::class); @@ -180,10 +180,10 @@ abstract class NodeTest extends \Test\TestCase { $this->assertEquals(2, $hooksRun); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testDeleteNotPermitted() { + $this->expectException(\OCP\Files\NotPermittedException::class); + $this->root->expects($this->any()) ->method('getUser') ->will($this->returnValue($this->user)); @@ -437,10 +437,10 @@ abstract class NodeTest extends \Test\TestCase { $this->assertEquals(2, $hooksRun); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testTouchNotPermitted() { + $this->expectException(\OCP\Files\NotPermittedException::class); + $this->root->expects($this->any()) ->method('getUser') ->will($this->returnValue($this->user)); @@ -454,10 +454,10 @@ abstract class NodeTest extends \Test\TestCase { $node->touch(100); } - /** - * @expectedException \OCP\Files\InvalidPathException - */ + public function testInvalidPath() { + $this->expectException(\OCP\Files\InvalidPathException::class); + $node = $this->createTestNode($this->root, $this->view, '/../foo'); $node->getFileInfo(); } @@ -488,10 +488,10 @@ abstract class NodeTest extends \Test\TestCase { $this->assertEquals(3, $target->getId()); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testCopyNotPermitted() { + $this->expectException(\OCP\Files\NotPermittedException::class); + /** * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage */ @@ -519,10 +519,10 @@ abstract class NodeTest extends \Test\TestCase { $node->copy('/bar/asd'); } - /** - * @expectedException \OCP\Files\NotFoundException - */ + public function testCopyNoParent() { + $this->expectException(\OCP\Files\NotFoundException::class); + $this->view->expects($this->never()) ->method('copy'); @@ -536,10 +536,10 @@ abstract class NodeTest extends \Test\TestCase { $node->copy('/bar/asd/foo'); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testCopyParentIsFile() { + $this->expectException(\OCP\Files\NotPermittedException::class); + $this->view->expects($this->never()) ->method('copy'); @@ -659,10 +659,10 @@ abstract class NodeTest extends \Test\TestCase { $this->assertEquals(4, $hooksRun); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testMoveNotPermitted() { + $this->expectException(\OCP\Files\NotPermittedException::class); + $this->view->expects($this->any()) ->method('getFileInfo') ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]))); @@ -681,10 +681,10 @@ abstract class NodeTest extends \Test\TestCase { $node->move('/bar/asd'); } - /** - * @expectedException \OCP\Files\NotFoundException - */ + public function testMoveNoParent() { + $this->expectException(\OCP\Files\NotFoundException::class); + /** * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage */ @@ -703,10 +703,10 @@ abstract class NodeTest extends \Test\TestCase { $node->move('/bar/asd'); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testMoveParentIsFile() { + $this->expectException(\OCP\Files\NotPermittedException::class); + $this->view->expects($this->never()) ->method('rename'); @@ -721,10 +721,10 @@ abstract class NodeTest extends \Test\TestCase { $node->move('/bar/asd'); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testMoveFailed() { + $this->expectException(\OCP\Files\NotPermittedException::class); + $this->view->expects($this->any()) ->method('rename') ->with('/bar/foo', '/bar/asd') @@ -744,10 +744,10 @@ abstract class NodeTest extends \Test\TestCase { $node->move('/bar/asd'); } - /** - * @expectedException \OCP\Files\NotPermittedException - */ + public function testCopyFailed() { + $this->expectException(\OCP\Files\NotPermittedException::class); + $this->view->expects($this->any()) ->method('copy') ->with('/bar/foo', '/bar/asd') |