public function testAuthCheckToken()
{
$restoreInstance = PMA\libraries\Response::getInstance();
$mockResponse = $this->getMockBuilder('PMA\\libraries\\Response')->disableOriginalConstructor()->setMethods(array('isAjax', 'headersSent', 'header'))->getMock();
$mockResponse->expects($this->any())->method('headersSent')->with()->will($this->returnValue(false));
$mockResponse->expects($this->once())->method('header')->with('Location: https://example.com/SignonURL');
$attrInstance = new ReflectionProperty('PMA\\libraries\\Response', '_instance');
$attrInstance->setAccessible(true);
$attrInstance->setValue($mockResponse);
$GLOBALS['cfg']['Server']['SignonURL'] = 'https://example.com/SignonURL';
$GLOBALS['cfg']['Server']['SignonSession'] = 'session123';
$GLOBALS['cfg']['Server']['host'] = 'localhost';
$GLOBALS['cfg']['Server']['port'] = '80';
$GLOBALS['cfg']['Server']['user'] = 'user';
$GLOBALS['cfg']['Server']['SignonScript'] = '';
$_COOKIE['session123'] = true;
$_SESSION['PMA_single_signon_user'] = 'user123';
$_SESSION['PMA_single_signon_password'] = 'pass123';
$_SESSION['PMA_single_signon_host'] = 'local';
$_SESSION['PMA_single_signon_port'] = '12';
$_SESSION['PMA_single_signon_cfgupdate'] = array('foo' => 'bar');
$_SESSION['PMA_single_signon_token'] = 'pmaToken';
$sessionName = session_name();
$sessionID = session_id();
$this->object->logOut();
$this->assertEquals(array('SignonURL' => 'https://example.com/SignonURL', 'SignonScript' => '', 'SignonSession' => 'session123', 'host' => 'localhost', 'port' => '80', 'user' => 'user'), $GLOBALS['cfg']['Server']);
$this->assertEquals($sessionName, session_name());
$this->assertEquals($sessionID, session_id());
$this->assertFalse(isset($_SESSION['LAST_SIGNON_URL']));
$attrInstance->setValue($restoreInstance);
}