JsonPath
JsonPath copied to clipboard
test case have a error
public function testGetAllByKeyFiltered() { $data = $this->jsonStore->get("$..book[(@.code=='02.01')].category"); $expected = ["fiction", "fiction"]; $this->assertEquals($data, $expected); }
$data = $this->jsonStore->get("$..book[?(@.code=='02.01')].category"); ? discard
Yep, I see this too:
#> ../../vendor/bin/phpunit jsonpath/tests/
PHPUnit 3.7.38 by Sebastian Bergmann.
...E
Time: 98 ms, Memory: 3.00Mb
There was 1 error:
1) tests\JsonStoreTest::testGetAllByKeyFiltered
Undefined index: code
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:235
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:164
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:154
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:160
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:190
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:204
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:161
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonPath.php:34
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonStore.php:217
/home/sites/htdocs/vendor/peekmo/jsonpath/src/Peekmo/JsonPath/JsonStore.php:88
/home/sites/htdocs/vendor/peekmo/jsonpath/tests/JsonStoreTest.php:92