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 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);
 }
 /**
  * Test for PMA\libraries\plugins\auth\AuthenticationConfig::authFails
  *
  * @return void
  */
 public function testAuthFails()
 {
     if (!defined('PMA_TEST_HEADERS')) {
         $this->markTestSkipped('Cannot redefine constant/function - missing runkit extension');
     }
     $this->object = $this->getMockBuilder('PMA\\libraries\\plugins\\auth\\AuthenticationCookie')->disableOriginalConstructor()->setMethods(array('auth'))->getMock();
     $this->object->expects($this->exactly(5))->method('auth');
     $GLOBALS['server'] = 2;
     $_COOKIE['pmaPass-2'] = 'pass';
     // case 1
     $GLOBALS['login_without_password_is_forbidden'] = '1';
     $this->object->authFails();
     $this->assertEquals($GLOBALS['conn_error'], 'Login without a password is forbidden by configuration' . ' (see AllowNoPassword)');
     $this->assertEquals($GLOBALS['header'], array('Cache-Control: no-store, no-cache, must-revalidate', 'Pragma: no-cache'));
     // case 2
     $GLOBALS['login_without_password_is_forbidden'] = '';
     $GLOBALS['allowDeny_forbidden'] = '1';
     $this->object->authFails();
     $this->assertEquals($GLOBALS['conn_error'], 'Access denied!');
     // case 3
     $GLOBALS['allowDeny_forbidden'] = '';
     $GLOBALS['no_activity'] = '1';
     $GLOBALS['cfg']['LoginCookieValidity'] = 10;
     $this->object->authFails();
     $this->assertEquals($GLOBALS['conn_error'], 'No activity within 10 seconds; please log in again.');
     // case 4
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->at(0))->method('getError')->will($this->returnValue(false));
     $dbi->expects($this->at(1))->method('getError')->will($this->returnValue(false));
     $GLOBALS['dbi'] = $dbi;
     $GLOBALS['no_activity'] = '';
     $GLOBALS['errno'] = 42;
     $this->object->authFails();
     $this->assertEquals($GLOBALS['conn_error'], '#42 Cannot log in to the MySQL server');
     // case 5
     unset($GLOBALS['errno']);
     $this->object->authFails();
     $this->assertEquals($GLOBALS['conn_error'], 'Cannot log in to the MySQL server');
 }