diff options
author | Christian Weiske <cweiske@cweiske.de> | 2011-05-12 19:24:34 +0200 |
---|---|---|
committer | Christian Weiske <cweiske@cweiske.de> | 2011-05-12 19:24:34 +0200 |
commit | fbfbd8d5cae579058b5d31b97c062cefd9bb36b6 (patch) | |
tree | 55b52f5094d73e199db55dc955273c9e2403a6cb /tests | |
parent | 0901501fc741cec51a8060321ea0eb25d3859e1a (diff) | |
parent | b57c8d4581b05cd70a363cacd37f9ffc7da785d8 (diff) | |
download | semanticscuttle-fbfbd8d5cae579058b5d31b97c062cefd9bb36b6.tar.gz semanticscuttle-fbfbd8d5cae579058b5d31b97c062cefd9bb36b6.tar.bz2 |
Merge branch 'master' into ssl-client-certs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Api/OpenSearchTest.php | 2 | ||||
-rw-r--r-- | tests/TestBaseApi.php | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/Api/OpenSearchTest.php b/tests/Api/OpenSearchTest.php index 050713b..f438b46 100644 --- a/tests/Api/OpenSearchTest.php +++ b/tests/Api/OpenSearchTest.php @@ -27,7 +27,7 @@ class Api_OpenSearchTest extends TestBaseApi 1, count($arElements), 'OpenSearch link in HTML is missing' ); - $searchDescUrl = (string)$arElements[0]['href']; + $searchDescUrl = $this->completeUrl((string)$arElements[0]['href']); $this->assertNotNull($searchDescUrl, 'Search description URL is empty'); $req = new HTTP_Request2($searchDescUrl); 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 |