markTestSkipped( 'Cannot redefine constant/function - missing runkit extension' ); } // case 1 $formDisplay = $this->getMockBuilder('PMA\libraries\config\FormDisplay') ->disableOriginalConstructor() ->setMethods(array('process', 'getDisplay')) ->getMock(); $formDisplay->expects($this->once()) ->method('process') ->with(false) ->will($this->returnValue(false)); $formDisplay->expects($this->once()) ->method('getDisplay') ->with(true, true); PMA_Process_formset($formDisplay); // case 2 $formDisplay = $this->getMockBuilder('PMA\libraries\config\FormDisplay') ->disableOriginalConstructor() ->setMethods(array('process', 'hasErrors', 'displayErrors')) ->getMock(); $formDisplay->expects($this->once()) ->method('process') ->with(false) ->will($this->returnValue(true)); $formDisplay->expects($this->once()) ->method('hasErrors') ->with() ->will($this->returnValue(true)); ob_start(); PMA_Process_formset($formDisplay); $result = ob_get_clean(); $this->assertContains( '
', $result ); $this->assertContains( '', $result ); $this->assertContains( '', $result ); $this->assertContains( '', $result ); // case 3 $formDisplay = $this->getMockBuilder('PMA\libraries\config\FormDisplay') ->disableOriginalConstructor() ->setMethods(array('process', 'hasErrors')) ->getMock(); $formDisplay->expects($this->once()) ->method('process') ->with(false) ->will($this->returnValue(true)); $formDisplay->expects($this->once()) ->method('hasErrors') ->with() ->will($this->returnValue(false)); PMA_Process_formset($formDisplay); $this->assertEquals( array('HTTP/1.1 303 See Other', 'Location: index.php?lang=en&token=token'), $GLOBALS['header'] ); } }