/** * Assert the URL * * @param null|string $url An optional URL to assert. * @return void * @todo Cover base with beginning and relative URL with trailing slash. * @todo What if there is no absolute URl and no base URl set? */ protected function _assertUrl($url = null) { if ($url) { $this->url = $url; } // Treat set url as absolute URL, if it begins with "http:" or "https:" if (strpos($this->url, 'http:') === 0 || strpos($this->url, 'https:') === 0) { $fullUrl = $this->url; } else { // Remove trailing slash(es) from base URL $baseUrl = $this->test->getBrowserUrl(); $baseUrl = rtrim($baseUrl, '/'); // Remove leading slash(es) from relative URL $relUrl = ltrim($this->url, '/'); // Build full URL with one slash in between $fullUrl = sprintf('%s/%s', $baseUrl, $relUrl); } $this->test->assertEquals($fullUrl, $this->test->url()); }