From aea9c9ddbb1c0fd51192ebdcb1d1dfa258298e8c Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 12 May 2011 19:09:30 +0200 Subject: fix a test that failed when using a base URL without protocol --- tests/TestBaseApi.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/TestBaseApi.php') diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php index 8ed41cd..036ab6b 100644 --- a/tests/TestBaseApi.php +++ b/tests/TestBaseApi.php @@ -92,6 +92,23 @@ class TestBaseApi extends TestBase } + /** + * Completes an URL that's missing the protocol. + * Useful when re-using URLs extracted from HTML + * + * @param string $url Potentially partial URL + * + * @return string Full URL + */ + protected function completeUrl($url) + { + if (substr($url, 0, 2) == '//') { + $url = 'http:' . $url; + } + return $url; + } + + /** * Creates a user and a HTTP request object and prepares -- cgit v1.2.3-54-g00ecf