diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-05-11 16:18:01 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-05-13 08:11:24 +0200 |
commit | 12fa748c49773d57f03052ef3cee4c72a2d3cdcc (patch) | |
tree | 3f5b8ba180d5b23ead240d6acd54cdc05f689364 /tests/lib/AppFramework/Http | |
parent | ab2df70e3ac0d8216c1986cc64aff83c215f1add (diff) | |
download | nextcloud-server-12fa748c49773d57f03052ef3cee4c72a2d3cdcc.tar.gz nextcloud-server-12fa748c49773d57f03052ef3cee4c72a2d3cdcc.zip |
Move the notmodified check to middleware where it belongs
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/AppFramework/Http')
-rw-r--r-- | tests/lib/AppFramework/Http/DispatcherTest.php | 10 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/HttpTest.php | 32 |
2 files changed, 1 insertions, 41 deletions
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 74dbf68c28a..c4c973aec90 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -181,19 +181,11 @@ class DispatcherTest extends \Test\TestCase { ->method('getStatus') ->willReturn(Http::STATUS_OK); $this->response->expects($this->once()) - ->method('getLastModified') - ->willReturn($this->lastModified); - $this->response->expects($this->once()) - ->method('getETag') - ->willReturn($this->etag); - $this->response->expects($this->once()) ->method('getHeaders') ->willReturn($responseHeaders); $this->http->expects($this->once()) ->method('getStatusHeader') - ->with($this->equalTo(Http::STATUS_OK), - $this->equalTo($this->lastModified), - $this->equalTo($this->etag)) + ->with($this->equalTo(Http::STATUS_OK)) ->willReturn($httpHeaders); $this->middlewareDispatcher->expects($this->once()) diff --git a/tests/lib/AppFramework/Http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php index 009bb39260d..d3d23425f7c 100644 --- a/tests/lib/AppFramework/Http/HttpTest.php +++ b/tests/lib/AppFramework/Http/HttpTest.php @@ -53,38 +53,6 @@ class HttpTest extends \Test\TestCase { $this->assertEquals('HTTP/1.0 200 OK', $header); } - - public function testEtagMatchReturnsNotModified() { - $http = new Http(['HTTP_IF_NONE_MATCH' => 'hi']); - - $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); - $this->assertEquals('HTTP/1.1 304 Not Modified', $header); - } - - - public function testQuotedEtagMatchReturnsNotModified() { - $http = new Http(['HTTP_IF_NONE_MATCH' => '"hi"']); - - $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); - $this->assertEquals('HTTP/1.1 304 Not Modified', $header); - } - - - public function testLastModifiedMatchReturnsNotModified() { - $dateTime = new \DateTime(null, new \DateTimeZone('GMT')); - $dateTime->setTimestamp('12'); - - $http = new Http( - [ - 'HTTP_IF_MODIFIED_SINCE' => 'Thu, 01 Jan 1970 00:00:12 +0000'] - ); - - $header = $http->getStatusHeader(Http::STATUS_OK, $dateTime); - $this->assertEquals('HTTP/1.1 304 Not Modified', $header); - } - - - public function testTempRedirectBecomesFoundInHttp10() { $http = new Http([], 'HTTP/1.0'); |