aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre/FileTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre/FileTest.php')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php50
1 files changed, 24 insertions, 26 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index d0c18f6cd9e..a3cf4560387 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -62,7 +62,7 @@ class FileTest extends TestCase {
/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
protected $config;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
unset($_SERVER['HTTP_OC_CHUNKED']);
unset($_SERVER['CONTENT_LENGTH']);
@@ -78,7 +78,7 @@ class FileTest extends TestCase {
$this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
}
- public function tearDown(): void {
+ protected function tearDown(): void {
$userManager = \OC::$server->getUserManager();
$userManager->get($this->user)->delete();
unset($_SERVER['HTTP_OC_CHUNKED']);
@@ -815,9 +815,10 @@ class FileTest extends TestCase {
/**
* Test setting name with setName() with invalid chars
*
- * @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
*/
public function testSetNameInvalidChars() {
+ $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+
// setup
$view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath'])
@@ -834,8 +835,7 @@ class FileTest extends TestCase {
$file->setName('/super*star.txt');
}
- /**
- */
+
public function testUploadAbort() {
// setup
$view = $this->getMockBuilder(View::class)
@@ -879,9 +879,7 @@ class FileTest extends TestCase {
$this->assertEmpty($this->listPartFiles($view, ''), 'No stray part files');
}
- /**
- *
- */
+
public function testDeleteWhenAllowed() {
// setup
$view = $this->getMockBuilder(View::class)
@@ -901,10 +899,10 @@ class FileTest extends TestCase {
$file->delete();
}
- /**
- * @expectedException \Sabre\DAV\Exception\Forbidden
- */
+
public function testDeleteThrowsWhenDeletionNotAllowed() {
+ $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
// setup
$view = $this->getMockBuilder(View::class)
->getMock();
@@ -919,10 +917,10 @@ class FileTest extends TestCase {
$file->delete();
}
- /**
- * @expectedException \Sabre\DAV\Exception\Forbidden
- */
+
public function testDeleteThrowsWhenDeletionFailed() {
+ $this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
// setup
$view = $this->getMockBuilder(View::class)
->getMock();
@@ -942,10 +940,10 @@ class FileTest extends TestCase {
$file->delete();
}
- /**
- * @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden
- */
+
public function testDeleteThrowsWhenDeletionThrows() {
+ $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+
// setup
$view = $this->getMockBuilder(View::class)
->getMock();
@@ -1112,10 +1110,10 @@ class FileTest extends TestCase {
];
}
- /**
- * @expectedException \Sabre\DAV\Exception\ServiceUnavailable
- */
+
public function testGetFopenFails() {
+ $this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
+
$view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
@@ -1132,10 +1130,10 @@ class FileTest extends TestCase {
$file->get();
}
- /**
- * @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden
- */
+
public function testGetFopenThrows() {
+ $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+
$view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
@@ -1152,10 +1150,10 @@ class FileTest extends TestCase {
$file->get();
}
- /**
- * @expectedException \Sabre\DAV\Exception\NotFound
- */
+
public function testGetThrowsIfNoPermission() {
+ $this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
$view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();