summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-10-13 12:59:10 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-10-20 15:15:48 +0200
commit08d688410747eba59c893a624942e9836749aa60 (patch)
treefb84c7116522b7034f6f2761bdcf6943c216654d /apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
parent5d7e9bb8fcbcd9a03cf0723c5258b41487850f7d (diff)
downloadnextcloud-server-08d688410747eba59c893a624942e9836749aa60.tar.gz
nextcloud-server-08d688410747eba59c893a624942e9836749aa60.zip
Sanitize length headers when validating quota
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php26
1 files changed, 12 insertions, 14 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
index 89bc1ee8adb..b37abdc9b05 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -24,22 +24,20 @@
*
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use Test\TestCase;
+
/**
* Copyright (c) 2013 Thomas Müller <thomas.mueller@tmit.eu>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
-class QuotaPluginTest extends \Test\TestCase {
+class QuotaPluginTest extends TestCase {
- /**
- * @var \Sabre\DAV\Server
- */
+ /** @var \Sabre\DAV\Server | \PHPUnit_Framework_MockObject_MockObject */
private $server;
- /**
- * @var \OCA\DAV\Connector\Sabre\QuotaPlugin
- */
+ /** @var \OCA\DAV\Connector\Sabre\QuotaPlugin | \PHPUnit_Framework_MockObject_MockObject */
private $plugin;
private function init($quota, $checkedPath = '') {
@@ -126,19 +124,19 @@ class QuotaPluginTest extends \Test\TestCase {
}
public function lengthProvider() {
- return array(
- array(null, array()),
- array(1024, array('X-EXPECTED-ENTITY-LENGTH' => '1024')),
- array(512, array('CONTENT-LENGTH' => '512')),
- array(2048, array('OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => '1024')),
- array(4096, array('OC-TOTAL-LENGTH' => '2048', 'X-EXPECTED-ENTITY-LENGTH' => '4096')),
+ return [
+ [null, []],
+ [1024, ['X-EXPECTED-ENTITY-LENGTH' => '1024']],
+ [512, ['CONTENT-LENGTH' => '512']],
+ [2048, ['OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => '1024']],
+ [4096, ['OC-TOTAL-LENGTH' => '2048', 'X-EXPECTED-ENTITY-LENGTH' => '4096']],
[null, ['X-EXPECTED-ENTITY-LENGTH' => 'A']],
[null, ['CONTENT-LENGTH' => 'A']],
[1024, ['OC-TOTAL-LENGTH' => 'A', 'CONTENT-LENGTH' => '1024']],
[1024, ['OC-TOTAL-LENGTH' => 'A', 'X-EXPECTED-ENTITY-LENGTH' => '1024']],
[null, ['OC-TOTAL-LENGTH' => '2048', 'X-EXPECTED-ENTITY-LENGTH' => 'A']],
[null, ['OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => 'A']],
- );
+ ];
}
public function quotaChunkedOkProvider() {