summaryrefslogtreecommitdiffstats
path: root/tests/Controller
diff options
context:
space:
mode:
authorArnold Daniels <arnold@jasny.net>2016-11-22 18:20:37 +0100
committerArnold Daniels <arnold@jasny.net>2016-11-22 18:20:37 +0100
commit787d161b72f50f7383ef7cba3af429f9b244a51c (patch)
treeb738165610f79aed38d9336d50e6691b74cf8c8c /tests/Controller
parentc59a50e4be6636a3efe8c8a15ffc61f83cc7b8e4 (diff)
downloadcontroller-787d161b72f50f7383ef7cba3af429f9b244a51c.zip
controller-787d161b72f50f7383ef7cba3af429f9b244a51c.tar.gz
controller-787d161b72f50f7383ef7cba3af429f9b244a51c.tar.bz2
Tests and fixes for setResponseHeaderv1.0.1
Diffstat (limited to 'tests/Controller')
-rw-r--r--tests/Controller/OutputTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/Controller/OutputTest.php b/tests/Controller/OutputTest.php
index 7ca0aa4..d77ccd8 100644
--- a/tests/Controller/OutputTest.php
+++ b/tests/Controller/OutputTest.php
@@ -13,6 +13,36 @@ class OutputTest extends \PHPUnit_Framework_TestCase
{
use TestHelper;
+
+ public function getSetResponseHeaderProvider()
+ {
+ return [
+ [true, 'withHeader'],
+ [false, 'withAddedHeader']
+ ];
+ }
+
+ /**
+ * @dataProvider getSetResponseHeaderProvider
+ *
+ * @param boolean $replace
+ * @param string $method
+ */
+ public function testSetResponseHeader($replace, $method)
+ {
+ $response = $this->createMock(ResponseInterface::class);
+ $finalResponse = $this->createMock(ResponseInterface::class);
+
+ $response->expects($this->once())->method($method)->with('Foo', 'bar')->willReturn($finalResponse);
+
+ $controller = $this->getController(['getResponse', 'setResponse']);
+
+ $controller->expects($this->once())->method('getResponse')->willReturn($response);
+ $controller->expects($this->once())->method('setResponse')->with($finalResponse);
+
+ $controller->setResponseHeader('Foo', 'bar', $replace);
+ }
+
/**
* Test function respondWith
*