summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2020-03-10 13:43:18 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-03-27 12:53:44 +0100
commit102a328e65518a730691a52fa9c1c76617371cac (patch)
tree0b66a98d46871200f580bfce9e182b394f04135b /apps/dav/tests
parent52ba75f6442ad326f5113cd3e89c4024118c4fcf (diff)
downloadnextcloud-server-102a328e65518a730691a52fa9c1c76617371cac.tar.gz
nextcloud-server-102a328e65518a730691a52fa9c1c76617371cac.zip
Fix usage of Sabre\HTTP\Request in unit tests
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php6
-rw-r--r--apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php12
-rw-r--r--apps/dav/tests/unit/DAV/Sharing/PluginTest.php5
5 files changed, 14 insertions, 18 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php
index cf62b6eb05d..f7972d37d43 100644
--- a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php
+++ b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php
@@ -82,9 +82,8 @@ class PluginTest extends TestCase {
$this->book->expects($this->once())->method('setPublishStatus')->with(true);
// setup request
- $request = new Request();
+ $request = new Request('POST', 'cal1');
$request->addHeader('Content-Type', 'application/xml');
- $request->setUrl('cal1');
$request->setBody('<o:publish-calendar xmlns:o="http://calendarserver.org/ns/"/>');
$response = new Response();
$this->plugin->httpPost($request, $response);
@@ -95,9 +94,8 @@ class PluginTest extends TestCase {
$this->book->expects($this->once())->method('setPublishStatus')->with(false);
// setup request
- $request = new Request();
+ $request = new Request('POST', 'cal1');
$request->addHeader('Content-Type', 'application/xml');
- $request->setUrl('cal1');
$request->setBody('<o:unpublish-calendar xmlns:o="http://calendarserver.org/ns/"/>');
$response = new Response();
$this->plugin->httpPost($request, $response);
diff --git a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
index 742f231287e..b8cdb70b7f9 100644
--- a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
+++ b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
@@ -47,7 +47,7 @@ class PluginTest extends TestCase {
protected function setUp(): void {
parent::setUp();
-
+
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */
$authBackend = $this->getMockBuilder(Auth::class)->disableOriginalConstructor()->getMock();
$authBackend->method('isDavAuthenticated')->willReturn(true);
@@ -75,9 +75,8 @@ class PluginTest extends TestCase {
]], ['mailto:wilfredo@example.com']);
// setup request
- $request = new Request();
+ $request = new Request('POST', 'addressbook1.vcf');
$request->addHeader('Content-Type', 'application/xml');
- $request->setUrl('addressbook1.vcf');
$request->setBody('<?xml version="1.0" encoding="utf-8" ?><CS:share xmlns:D="DAV:" xmlns:CS="http://owncloud.org/ns"><CS:set><D:href>principal:principals/admin</D:href><CS:read-write/></CS:set> <CS:remove><D:href>mailto:wilfredo@example.com</D:href></CS:remove></CS:share>');
$response = new Response();
$this->plugin->httpPost($request, $response);
diff --git a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php
index f2012a87a3d..29b549f3b4a 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php
@@ -54,7 +54,7 @@ class CopyEtagHeaderPluginTest extends TestCase {
}
public function testCopyEtag() {
- $request = new \Sabre\Http\Request();
+ $request = new \Sabre\Http\Request('GET', 'dummy.file');
$response = new \Sabre\Http\Response();
$response->setHeader('Etag', 'abcd');
@@ -64,7 +64,7 @@ class CopyEtagHeaderPluginTest extends TestCase {
}
public function testNoopWhenEmpty() {
- $request = new \Sabre\Http\Request();
+ $request = new \Sabre\Http\Request('GET', 'dummy.file');
$response = new \Sabre\Http\Response();
$this->plugin->afterMethod($request, $response);
diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
index d7554741fc0..f604ee8a685 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -66,7 +66,7 @@ class QuotaPluginTest extends TestCase {
$this->init(0);
$this->plugin->expects($this->never())
->method('getFileChunking');
- $this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
+ $this->server->httpRequest = new \Sabre\HTTP\Request('POST', 'dummy.file', $headers);
$length = $this->plugin->getLength();
$this->assertEquals($expected, $length);
}
@@ -79,7 +79,7 @@ class QuotaPluginTest extends TestCase {
$this->plugin->expects($this->never())
->method('getFileChunking');
- $this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
+ $this->server->httpRequest = new \Sabre\HTTP\Request('POST', 'dummy.file', $headers);
$result = $this->plugin->checkQuota('');
$this->assertTrue($result);
}
@@ -94,7 +94,7 @@ class QuotaPluginTest extends TestCase {
$this->plugin->expects($this->never())
->method('getFileChunking');
- $this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
+ $this->server->httpRequest = new \Sabre\HTTP\Request('POST', 'dummy.file', $headers);
$this->plugin->checkQuota('');
}
@@ -106,7 +106,7 @@ class QuotaPluginTest extends TestCase {
$this->plugin->expects($this->never())
->method('getFileChunking');
- $this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
+ $this->server->httpRequest = new \Sabre\HTTP\Request('POST', 'dummy.file', $headers);
$result = $this->plugin->checkQuota('/sub/test.txt');
$this->assertTrue($result);
}
@@ -191,7 +191,7 @@ class QuotaPluginTest extends TestCase {
->willReturn($mockChunking);
$headers['OC-CHUNKED'] = 1;
- $this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
+ $this->server->httpRequest = new \Sabre\HTTP\Request('POST', 'dummy.file', $headers);
$result = $this->plugin->checkQuota('/sub/test.txt-chunking-12345-3-1');
$this->assertTrue($result);
}
@@ -228,7 +228,7 @@ class QuotaPluginTest extends TestCase {
->willReturn($mockChunking);
$headers['OC-CHUNKED'] = 1;
- $this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
+ $this->server->httpRequest = new \Sabre\HTTP\Request('POST', 'dummy.file', $headers);
$this->plugin->checkQuota('/sub/test.txt-chunking-12345-3-1');
}
diff --git a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
index 9eeaccc29d7..9776d17642c 100644
--- a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
+++ b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
@@ -47,7 +47,7 @@ class PluginTest extends TestCase {
protected function setUp(): void {
parent::setUp();
-
+
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */
$authBackend = $this->getMockBuilder(Auth::class)->disableOriginalConstructor()->getMock();
$authBackend->method('isDavAuthenticated')->willReturn(true);
@@ -77,9 +77,8 @@ class PluginTest extends TestCase {
]], ['mailto:wilfredo@example.com']);
// setup request
- $request = new Request();
+ $request = new Request('POST', 'addressbook1.vcf');
$request->addHeader('Content-Type', 'application/xml');
- $request->setUrl('addressbook1.vcf');
$request->setBody('<?xml version="1.0" encoding="utf-8" ?><CS:share xmlns:D="DAV:" xmlns:CS="http://owncloud.org/ns"><CS:set><D:href>principal:principals/admin</D:href><CS:read-write/></CS:set> <CS:remove><D:href>mailto:wilfredo@example.com</D:href></CS:remove></CS:share>');
$response = new Response();
$this->plugin->httpPost($request, $response);