%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : www.kowitt.ac.th / Your IP : 216.73.216.118 Web Server : Microsoft-IIS/7.5 System : Windows NT SERVER02 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.6.31 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/BK/wwwroot/phpMyAdmin/test/libraries/ |
Upload File : |
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * tests for methods under Formset processing library * * @package PhpMyAdmin-test */ /* * Include to test */ require_once 'setup/lib/form_processing.lib.php'; /** * tests for methods under Formset processing library * * @package PhpMyAdmin-test */ class PMA_Form_Processing_Test extends PHPUnit_Framework_TestCase { /** * Prepares environment for the test. * * @return void */ public function setUp() { $GLOBALS['server'] = 1; $GLOBALS['cfg']['ServerDefault'] = 1; } /** * Test for process_formset() * * @return void */ public function testProcessFormSet() { if (!defined('PMA_TEST_HEADERS')) { $this->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( '<div class="error">', $result ); $this->assertContains( '<a href="?lang=en&token=token&page=&mode=revert">', $result ); $this->assertContains( '<a class="btn" href="index.php?lang=en&token=token">', $result ); $this->assertContains( '<a class="btn" href="?lang=en&token=token&page=&mode=edit">', $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'] ); } }