From da6a19bf59acc19a2accc9542dd2a6485a1ded02 Mon Sep 17 00:00:00 2001 From: Jaime Lopez Date: Thu, 3 Aug 2017 12:05:05 +0200 Subject: [PATCH] Adds new test for be sure that the 'minus' character is allowed --- tests/Skyscanner/JsonPath/JsonObjectTest.php | 39 +++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/tests/Skyscanner/JsonPath/JsonObjectTest.php b/tests/Skyscanner/JsonPath/JsonObjectTest.php index 0284e82..2b96bb4 100644 --- a/tests/Skyscanner/JsonPath/JsonObjectTest.php +++ b/tests/Skyscanner/JsonPath/JsonObjectTest.php @@ -61,7 +61,8 @@ class JsonPathTest extends \PHPUnit_Framework_TestCase "color": "red", "price": 19.95, "available": true, - "model": null + "model": null, + "sku-number": "BCCLE-0001-RD" } }, "authors": [ @@ -139,13 +140,18 @@ public function testGetProvider() array(19.95), "$.store.bicycle.price" ), + array( + array("BCCLE-0001-RD"), + "$.store.bicycle.sku-number" + ), array( array( array( "color" => "red", "price" => 19.95, "available" => true, - "model" => null + "model" => null, + "sku-number" => "BCCLE-0001-RD" ) ), "$.store.bicycle" @@ -220,7 +226,8 @@ public function testGetProvider() "red", 19.95, true, - null + null, + "BCCLE-0001-RD" ), "$.store.bicycle.*" ), @@ -288,13 +295,13 @@ public function testGetProvider() array( "red" ), - "$..*[?(@.length <= 4)].color" + "$..*[?(@.length <= 5)].color" ), array( array( "red" ), - "$..*[?(@.length <= 4.0)].color" + "$..*[?(@.length <= 5.0)].color" ), array( array( @@ -360,7 +367,8 @@ public function testGetProvider() "color" => "red", "price" => 19.95, "available" => true, - "model" => null + "model" => null, + "sku-number" => "BCCLE-0001-RD" ) ), "$.store[?(@.*.length == 3)]", @@ -417,7 +425,8 @@ public function testSmartGetProvider() "color" => "red", "price" => 19.95, "available" => true, - "model" => null + "model" => null, + "sku-number" => "BCCLE-0001-RD" ), "$.store.bicycle" ), @@ -491,7 +500,8 @@ public function testSmartGetProvider() "red", 19.95, true, - null + null, + "BCCLE-0001-RD" ), "$.store.bicycle.*" ), @@ -559,13 +569,13 @@ public function testSmartGetProvider() array( "red" ), - "$..*[?(@.length <= 4)].color" + "$..*[?(@.length <= 5)].color" ), array( array( "red" ), - "$..*[?(@.length <= 4.0)].color" + "$..*[?(@.length <= 5.0)].color" ), array( array( @@ -631,7 +641,8 @@ public function testSmartGetProvider() "color" => "red", "price" => 19.95, "available" => true, - "model" => null + "model" => null, + "sku-number" => "BCCLE-0001-RD" ) ), "$.store[?(@.*.length == 3)]", @@ -746,7 +757,8 @@ public function testAdd($smartGet) 'price' => 19.95, 'type' => 'BMX', 'available' => true, - 'model' => null + 'model' => null, + "sku-number" => "BCCLE-0001-RD" ) ); $expected = $smartGet ? $expected[0] : $expected; @@ -794,7 +806,8 @@ public function testRemove($smartGet) ], "bicycle": { "color": "red", - "model": null + "model": null, + "sku-number": "BCCLE-0001-RD" } }, "authors": [