diff options
author | Frank Karlitschek <frank@owncloud.org> | 2013-10-05 02:25:45 -0700 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2013-10-05 02:25:45 -0700 |
commit | a82211220ca8a39ae0fc517461062f2bda4acc9b (patch) | |
tree | 2a8bad9bb2afd1099560b3d54a7b803d8923ac3f /tests/lib | |
parent | 4bce2f8b85dbbe8fb25dc64b2bc049342d2d1ae7 (diff) | |
parent | 414b2eb4b672ef5d49985de27edca3e5bb54d5d6 (diff) | |
download | nextcloud-server-a82211220ca8a39ae0fc517461062f2bda4acc9b.tar.gz nextcloud-server-a82211220ca8a39ae0fc517461062f2bda4acc9b.zip |
Merge pull request #5125 from owncloud/fixing-5122-master
upload abortion detection only for PUT
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/connector/sabre/aborteduploaddetectionplugin.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/lib/connector/sabre/aborteduploaddetectionplugin.php b/tests/lib/connector/sabre/aborteduploaddetectionplugin.php index bef0e4c4d7d..201f1263867 100644 --- a/tests/lib/connector/sabre/aborteduploaddetectionplugin.php +++ b/tests/lib/connector/sabre/aborteduploaddetectionplugin.php @@ -37,10 +37,11 @@ class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Frame /** * @dataProvider verifyContentLengthProvider */ - public function testVerifyContentLength($fileSize, $headers) + public function testVerifyContentLength($method, $fileSize, $headers) { $this->plugin->fileView = $this->buildFileViewMock($fileSize); + $headers['REQUEST_METHOD'] = $method; $this->server->httpRequest = new Sabre_HTTP_Request($headers); $this->plugin->verifyContentLength('foo.txt'); $this->assertTrue(true); @@ -50,30 +51,33 @@ class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Frame * @dataProvider verifyContentLengthFailedProvider * @expectedException Sabre_DAV_Exception_BadRequest */ - public function testVerifyContentLengthFailed($fileSize, $headers) + public function testVerifyContentLengthFailed($method, $fileSize, $headers) { $this->plugin->fileView = $this->buildFileViewMock($fileSize); // we expect unlink to be called $this->plugin->fileView->expects($this->once())->method('unlink'); - + $headers['REQUEST_METHOD'] = $method; $this->server->httpRequest = new Sabre_HTTP_Request($headers); $this->plugin->verifyContentLength('foo.txt'); } public function verifyContentLengthProvider() { return array( - array(1024, array()), - array(1024, array('HTTP_X_EXPECTED_ENTITY_LENGTH' => '1024')), - array(512, array('HTTP_CONTENT_LENGTH' => '512')), + array('PUT', 1024, array()), + array('PUT', 1024, array('HTTP_X_EXPECTED_ENTITY_LENGTH' => '1024')), + array('PUT', 512, array('HTTP_CONTENT_LENGTH' => '512')), + array('LOCK', 1024, array()), + array('LOCK', 1024, array('HTTP_X_EXPECTED_ENTITY_LENGTH' => '1024')), + array('LOCK', 512, array('HTTP_CONTENT_LENGTH' => '512')), ); } public function verifyContentLengthFailedProvider() { return array( - array(1025, array('HTTP_X_EXPECTED_ENTITY_LENGTH' => '1024')), - array(525, array('HTTP_CONTENT_LENGTH' => '512')), + array('PUT', 1025, array('HTTP_X_EXPECTED_ENTITY_LENGTH' => '1024')), + array('PUT', 525, array('HTTP_CONTENT_LENGTH' => '512')), ); } @@ -87,7 +91,7 @@ class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Frame } private function buildFileViewMock($fileSize) { - // mock filesysten + // mock filesystem $view = $this->getMock('\OC\Files\View', array('filesize', 'unlink'), array(), '', FALSE); $view->expects($this->any())->method('filesize')->withAnyParameters()->will($this->returnValue($fileSize)); |