AuthenticationHttpTest::testAuthCheck PHP Method

testAuthCheck() public method

Test for PMA\libraries\plugins\auth\AuthenticationHttp::authCheck
public testAuthCheck ( string $user, string $pass, string $userIndex, string $passIndex, string $expectedReturn, string $expectedUser, string $expectedPass, string $old_usr = '' ) : void
$user string test username
$pass string test password
$userIndex string index to test username against
$passIndex string index to test username against
$expectedReturn string expected return value from test
$expectedUser string expected username to be set
$expectedPass string expected password to be set
$old_usr string value for $_REQUEST['old_usr']
return void
    public function testAuthCheck($user, $pass, $userIndex, $passIndex, $expectedReturn, $expectedUser, $expectedPass, $old_usr = '')
    {
        $GLOBALS['PHP_AUTH_USER'] = '';
        $GLOBALS['PHP_AUTH_PW'] = '';
        $_SERVER[$userIndex] = $user;
        $_SERVER[$passIndex] = $pass;
        $_REQUEST['old_usr'] = $old_usr;
        $this->assertEquals($expectedReturn, $this->object->authCheck());
        $this->assertEquals($expectedUser, $GLOBALS['PHP_AUTH_USER']);
        $this->assertEquals($expectedPass, $GLOBALS['PHP_AUTH_PW']);
        $_SERVER[$userIndex] = null;
        $_SERVER[$passIndex] = null;
    }