diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-31 23:07:48 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-31 23:07:48 +0200 |
commit | 21a87d3c2eeaad6034df505f173c75a0ab804225 (patch) | |
tree | 40653c9076fa4c026b601aa43684f69992cdf863 /tests | |
parent | 2685129184472a308a3ba7730207816151b0ffd7 (diff) | |
download | nextcloud-server-21a87d3c2eeaad6034df505f173c75a0ab804225.tar.gz nextcloud-server-21a87d3c2eeaad6034df505f173c75a0ab804225.zip |
No body or content-length for 204 and 304 responses
See: https://tools.ietf.org/html/rfc7230#section-3.3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/AppFramework/AppTest.php | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php index 92ebd1f81e7..93b8768e674 100644 --- a/tests/lib/AppFramework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -25,6 +25,7 @@ namespace Test\AppFramework; use OC\AppFramework\App; +use OCP\AppFramework\Http; use OCP\AppFramework\Http\Response; @@ -134,7 +135,7 @@ class AppTest extends \Test\TestCase { public function testOutputIsPrinted(){ - $return = [null, [], [], $this->output, new Response()]; + $return = [Http::STATUS_OK, [], [], $this->output, new Response()]; $this->dispatcher->expects($this->once()) ->method('dispatch') ->with($this->equalTo($this->controller), @@ -146,6 +147,32 @@ class AppTest extends \Test\TestCase { App::main($this->controllerName, $this->controllerMethod, $this->container, []); } + public function dataNoOutput() { + return [ + [Http::STATUS_NO_CONTENT], + [Http::STATUS_NOT_MODIFIED], + ]; + } + + /** + * @dataProvider dataNoOutput + * @param int $statusCode + */ + public function testNoOutput($statusCode) { + $return = [$statusCode, [], [], $this->output, new Response()]; + $this->dispatcher->expects($this->once()) + ->method('dispatch') + ->with($this->equalTo($this->controller), + $this->equalTo($this->controllerMethod)) + ->will($this->returnValue($return)); + $this->io->expects($this->once()) + ->method('setHeader') + ->with($this->equalTo($statusCode)); + $this->io->expects($this->never()) + ->method('setOutput'); + App::main($this->controllerName, $this->controllerMethod, $this->container, []); + } + public function testCallbackIsCalled(){ $mock = $this->getMockBuilder('OCP\AppFramework\Http\ICallbackResponse') |