diff --git a/test/PMATestCase.php b/test/PMATestCase.php index 418a635f47..e949457a7f 100644 --- a/test/PMATestCase.php +++ b/test/PMATestCase.php @@ -43,15 +43,17 @@ class PMATestCase extends PHPUnit_Framework_TestCase $param = func_get_args(); - if (is_array($param[0])) { - $header_method = $mockResponse->expects($this->exactly(count($param))) - ->method('header'); + if (count($param) > 0) { + if (is_array($param[0])) { + $header_method = $mockResponse->expects($this->exactly(count($param))) + ->method('header'); - call_user_func_array(array($header_method, 'withConsecutive'), $param); - } else { - $mockResponse->expects($this->once()) - ->method('header') - ->with($param[0]); + call_user_func_array(array($header_method, 'withConsecutive'), $param); + } else { + $mockResponse->expects($this->once()) + ->method('header') + ->with($param[0]); + } } $this->attrInstance = new ReflectionProperty('PMA\libraries\Response', '_instance'); diff --git a/test/libraries/core/PMA_headerLocation_test.php b/test/libraries/core/PMA_headerLocation_test.php index 18864415a1..046acc1c06 100644 --- a/test/libraries/core/PMA_headerLocation_test.php +++ b/test/libraries/core/PMA_headerLocation_test.php @@ -126,27 +126,8 @@ class PMA_HeaderLocation_Test extends PMATestCase $this->expectOutputString($header); - $restoreInstance = PMA\libraries\Response::getInstance(); - - $mockResponse = $this->getMockBuilder('PMA\libraries\Response') - ->disableOriginalConstructor() - ->setMethods(array('disable', 'header', 'headersSent')) - ->getMock(); - - $mockResponse->expects($this->once()) - ->method('disable'); - - $mockResponse->expects($this->any()) - ->method('headersSent') - ->with() - ->will($this->returnValue(false)); - - $attrInstance = new ReflectionProperty('PMA\libraries\Response', '_instance'); - $attrInstance->setAccessible(true); - $attrInstance->setValue($mockResponse); + $this->mockResponse(); PMA_sendHeaderLocation($testUri); - - $attrInstance->setValue($restoreInstance); } -} \ No newline at end of file +}