]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/php/Nominatim/ParameterParserTest.php
tests for legacy tokenizer
[nominatim.git] / test / php / Nominatim / ParameterParserTest.php
index 75f6b276ae19fd5bcd143f399016fff36742a97e..3b06e2740a74a824a69280e5b42fd9f9909bfe78 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Nominatim;
 
-require_once(CONST_BasePath.'/lib/ParameterParser.php');
+require_once(CONST_LibDir.'/ParameterParser.php');
 
 
 function userError($sError)
@@ -246,4 +246,22 @@ class ParameterParserTest extends \PHPUnit\Framework\TestCase
                            'type' => 'type',
                           ), $oParams->getPreferredLanguages('default'));
     }
+
+    public function testHasSetAny()
+    {
+        $oParams = new ParameterParser(array(
+                                        'one' => '',
+                                        'two' => 0,
+                                        'three' => '0',
+                                        'four' => '1',
+                                        'five' => 'anystring'
+        ));
+        $this->assertFalse($oParams->hasSetAny(array()));
+        $this->assertFalse($oParams->hasSetAny(array('')));
+        $this->assertFalse($oParams->hasSetAny(array('unknown')));
+        $this->assertFalse($oParams->hasSetAny(array('one', 'two', 'three')));
+        $this->assertTrue($oParams->hasSetAny(array('one', 'four')));
+        $this->assertTrue($oParams->hasSetAny(array('four')));
+        $this->assertTrue($oParams->hasSetAny(array('five')));
+    }
 }