]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
verify we get the correct search URL
authorChristian Weiske <cweiske@cweiske.de>
Thu, 14 Apr 2011 15:04:57 +0000 (17:04 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 14 Apr 2011 15:04:57 +0000 (17:04 +0200)
tests/Api/OpenSearchTest.php

index a2423191cb56a48fd7e6fb125387be557133c260..050713b85efdd5feeec9e2af43abbae42417ec73 100644 (file)
@@ -54,6 +54,23 @@ class Api_OpenSearchTest extends TestBaseApi
         );
     }
 
+    public function testOpenSearchSearchUrl()
+    {
+        $xml = $this->getRequest('api/opensearch.php')->send()->getBody();
+        $x = simplexml_load_string($xml);
+        $x->registerXPathNamespace('os', reset($x->getDocNamespaces()));
+
+        $arElements = $x->xpath('//os:Url[@type="text/html"]');
+        $this->assertEquals(
+            1, count($arElements),
+            'Url in OpenSearch description is missing'
+        );
+        $this->assertEquals(
+            $GLOBALS['unittestUrl'] . 'search.php/all/{searchTerms}',
+            (string)$arElements[0]['template']
+        );
+    }
+
 }
 
 ?>
\ No newline at end of file