AuthenticationCookieTest::testAuthCheckDecryptPassword PHP Method

testAuthCheckDecryptPassword() public method

Test for PMA\libraries\plugins\auth\AuthenticationConfig::authCheck (mocking blowfish functions)
public testAuthCheckDecryptPassword ( ) : void
return void
    public function testAuthCheckDecryptPassword()
    {
        $GLOBALS['server'] = 1;
        $_REQUEST['old_usr'] = '';
        $_REQUEST['pma_username'] = '';
        $_COOKIE['pmaServer-1'] = 'pmaServ1';
        $_COOKIE['pmaUser-1'] = 'pmaUser1';
        $_COOKIE['pmaAuth-1'] = 'pmaAuth1';
        $_COOKIE['pma_iv-1'] = base64_encode('testiv09testiv09');
        $GLOBALS['cfg']['blowfish_secret'] = 'secret';
        $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';
        $GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';
        $_SESSION['last_access_time'] = time() - 1000;
        $GLOBALS['cfg']['LoginCookieValidity'] = 1440;
        // mock for blowfish function
        $this->object = $this->getMockBuilder('PMA\\libraries\\plugins\\auth\\AuthenticationCookie')->disableOriginalConstructor()->setMethods(array('cookieDecrypt'))->getMock();
        $this->object->expects($this->at(1))->method('cookieDecrypt')->will($this->returnValue('{"password":""}'));
        $this->assertTrue($this->object->authCheck());
        $this->assertTrue($GLOBALS['from_cookie']);
        $this->assertEquals('', $GLOBALS['PHP_AUTH_PW']);
    }