X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a885e7309ab1feba1e2ec7b183eb383e775c162e..b8a73192128b162ea32bf2f622875a543a39d955:/test/php/Nominatim/DebugTest.php diff --git a/test/php/Nominatim/DebugTest.php b/test/php/Nominatim/DebugTest.php index 7ed08122..84e8f215 100644 --- a/test/php/Nominatim/DebugTest.php +++ b/test/php/Nominatim/DebugTest.php @@ -1,20 +1,32 @@ oWithDebuginfo = $this->getMock(Geocode::class, array('debugInfo')); + $this->oWithDebuginfo = $this->getMockBuilder(\GeococdeMock::class) + ->setMethods(array('debugInfo')) + ->getMock(); $this->oWithDebuginfo->method('debugInfo') ->willReturn(array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3')); - $this->oWithToString = $this->getMock(Geocode::class, array('__toString')); + + $this->oWithToString = $this->getMockBuilder(\SomeMock::class) + ->setMethods(array('__toString')) + ->getMock(); $this->oWithToString->method('__toString')->willReturn('me as string'); } @@ -25,14 +37,14 @@ class DebugTest extends \PHPUnit_Framework_TestCase
Var1:  True
Var2:  False
Var3:  0
-
Var4:  'String'
-
Var5:  0 => 'one'
-       1 => 'two'
-       2 => 'three'
-
Var6:  'key' => 'value'
-       'key2' => 'value2'
+
Var4:  'String'
+
Var5:  0 => 'one'
+       1 => 'two'
+       2 => 'three'
+
Var6:  'key' => 'value'
+       'key2' => 'value2'
Var7:  me as string
-
Var8:  'value', 'value2'
+
Var8:  'value', 'value2'
EOT ); @@ -52,10 +64,10 @@ EOT public function testDebugArray() { $this->expectOutputString(<<Arr0: 'null' -
Arr1:  'key1' => 'val1'
-       'key2' => 'val2'
-       'key3' => 'val3'
+
Arr0:  'null'
+
Arr1:  'key1' => 'val1'
+       'key2' => 'val2'
+       'key3' => 'val3'
EOT ); @@ -81,12 +93,12 @@ EOT 1 -
'one'
-
'two'
+
'one'
+
'two'
-
'three'
-
'four'
+
'three'
+
'four'
Table4: @@ -97,9 +109,9 @@ EOT key3 -
'val1'
-
'val2'
-
'val3'
+
'val1'
+
'val2'
+
'val3'
@@ -135,18 +147,18 @@ EOT
group1
-
'val1'
-
'val2'
+
'val1'
+
'val2'
group1
-
'one'
-
'two'
+
'one'
+
'two'
group2
-
'val1'
-
'val2'
+
'val1'
+
'val2'
Table4: @@ -159,15 +171,15 @@ EOT
group1
-
'val1'
-
'val2'
-
'val3'
+
'val1'
+
'val2'
+
'val3'
group1
-
'val1'
-
'val2'
-
'val3'
+
'val1'
+
'val2'
+
'val3'
@@ -179,19 +191,19 @@ EOT // header are taken from first group item, thus no key3 gets printed $aGroups = array( - 'group1' => array( - array('key1' => 'val1', 'key2' => 'val2'), - array('key1' => 'one', 'key2' => 'two', 'unknown' => 1), - ), - 'group2' => array( - array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3'), - ) - ); + 'group1' => array( + array('key1' => 'val1', 'key2' => 'val2'), + array('key1' => 'one', 'key2' => 'two', 'unknown' => 1), + ), + 'group2' => array( + array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3'), + ) + ); Debug::printGroupTable('Table3', $aGroups); $aGroups = array( - 'group1' => array($this->oWithDebuginfo, $this->oWithDebuginfo), - ); + 'group1' => array($this->oWithDebuginfo, $this->oWithDebuginfo), + ); Debug::printGroupTable('Table4', $aGroups); } }