protected function compareUrl($expectedUrl, $actualUrl)
    {
        $expectedUrlInfo = parse_url($expectedUrl);
        $actualUrlInfo = parse_url($actualUrl);
        foreach ($expectedUrlInfo as $name => $expectedValue) {
            if ($name == 'query') {
                parse_str($expectedValue, $expectedUrlParams);
                parse_str($actualUrlInfo[$name], $actualUrlParams);
                $paramsDiff = array_diff_assoc($expectedUrlParams, $actualUrlParams);
                if (!empty($paramsDiff)) {
                    return false;
                }
            } elseif ($expectedValue != $actualUrlInfo[$name]) {
                return false;
            }
        }
        return true;
    }
protected function compareUrl($expectedUrl, $actualUrl)
    {
        $expectedUrlInfo = parse_url($expectedUrl);
        $actualUrlInfo = parse_url($actualUrl);
        foreach ($expectedUrlInfo as $name => $expectedValue) {
            if ($name == 'query') {
                parse_str($expectedValue, $expectedUrlParams);
                parse_str($actualUrlInfo[$name], $actualUrlParams);
                $paramsDiff = array_diff_assoc($expectedUrlParams, $actualUrlParams);
                if (!empty($paramsDiff)) {
                    return false;
                }
            } elseif ($expectedValue != $actualUrlInfo[$name]) {
                return false;
            }
        }
        return true;
    }
protected function compareUrl ( $ expectedUrl , $ actualUrl ) { $ expectedUrlInfo = parse_url ( $ expectedUrl ) ; $ actualUrlInfo = parse_url ( $ actualUrl ) ; foreach ( $ expectedUrlInfo as $ name => $ expectedValue ) { if ( $ name == 'query' ) { parse_str ( $ expectedValue , $ expectedUrlParams ) ; parse_str ( $ actualUrlInfo [ $ name ] , $ actualUrlParams ) ; $ paramsDiff = array_diff_assoc ( $ expectedUrlParams , $ actualUrlParams ) ; if ( ! empty ( $ paramsDiff ) ) { return false ; } } elseif ( $ expectedValue != $ actualUrlInfo [ $ name ] ) { return false ; } } return true ; }
Compares 2 URLs taking in account possible GET parameters order miss match and URL encoding inconsistencies.
@param string $expectedUrl expected URL.
@param string $actualUrl actual URL.
@return bool whether URLs are equal.
Compares 2 URLs taking in account possible GET parameters order miss match and URL encoding inconsistencies .