enableBc(); $GLOBALS['server'] = 0; $this->object = new AuthenticationConfig(null); } /** * tearDown for test cases * * @return void */ public function tearDown() { unset($this->object); } /** * Test for AuthenticationConfig::auth * * @return void */ public function testAuth() { $this->assertTrue( $this->object->auth() ); } /** * Test for AuthenticationConfig::authCheck * * @return void */ public function testAuthCheck() { $this->assertTrue( $this->object->authCheck() ); } /** * Test for AuthenticationConfig::authSetUser * * @return void */ public function testAuthSetUser() { $this->assertTrue( $this->object->authSetUser() ); } /** * Test for AuthenticationConfig::authFails * * @return void */ public function testAuthFails() { $removeConstant = false; $GLOBALS['error_handler'] = new PMA_Error_Handler; $GLOBALS['cfg']['Servers'] = array(1); $GLOBALS['allowDeny_forbidden'] = false; if (!defined('PMA_USR_BROWSER_AGENT')) { define('PMA_USR_BROWSER_AGENT', 'chrome'); $removeConstant = true; if (! PMA_HAS_RUNKIT) { $this->markTestSkipped('Cannot remove constant'); } } ob_start(); $result = $this->object->authFails(); $html = ob_get_clean(); $this->assertTrue( $result ); $this->assertContains( 'You probably did not create a configuration file. You might want ' . 'to use the setup script to create one.', $html ); $this->assertContains( 'MySQL said: ' . 'Documentation', $html ); $this->assertContains( 'Cannot connect: invalid settings.', $html ); $this->assertContains( 'Retry to connect', $html ); if ($removeConstant) { runkit_constant_remove('PMA_USR_BROWSER_AGENT'); } } } ?>