PMA\libraries\plugins\auth\AuthenticationCookie::authFails PHP Method

authFails() public method

prepares error message and switches to auth() which display the error and the login form this function MUST exit/quit the application, currently done by call to auth()
public authFails ( ) : void
return void
    public function authFails()
    {
        global $conn_error;
        // Deletes password cookie and displays the login form
        $GLOBALS['PMA_Config']->removeCookie('pmaAuth-' . $GLOBALS['server']);
        $conn_error = $this->getErrorMessage();
        $response = Response::getInstance();
        // needed for PHP-CGI (not need for FastCGI or mod-php)
        $response->header('Cache-Control: no-store, no-cache, must-revalidate');
        $response->header('Pragma: no-cache');
        $this->auth();
    }

Usage Example

 public function doMockResponse()
 {
     $restoreInstance = PMA\libraries\Response::getInstance();
     // set mocked headers and footers
     $mockResponse = $this->getMockBuilder('PMA\\libraries\\Response')->disableOriginalConstructor()->setMethods(array('header', 'headersSent'))->getMock();
     $mockResponse->expects($this->any())->method('headersSent')->with()->will($this->returnValue(false));
     $attrInstance = new ReflectionProperty('PMA\\libraries\\Response', '_instance');
     $attrInstance->setAccessible(true);
     $attrInstance->setValue($mockResponse);
     $headers = func_get_args();
     $header_method = $mockResponse->expects($this->exactly(count($headers)))->method('header');
     call_user_func_array(array($header_method, 'withConsecutive'), $headers);
     $this->object->authFails();
     $attrInstance->setValue($restoreInstance);
 }
All Usage Examples Of PMA\libraries\plugins\auth\AuthenticationCookie::authFails