From 36137251c09894995a33c655fd76e9e6beebdd89 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Mon, 26 Oct 2020 17:55:33 +0100 Subject: [PATCH 1/6] Update REST.php * I created a new header "JSONPath", and moved the *general* JSONPath infos from `grabDataFromResponseByJsonPath` to it - in preparation for removing `flow/jsonpath` as a dependency, see https://github.com/Codeception/module-rest/issues/24#issuecomment-714807087 * I removed the "Parts" header, cause it seemed useless to me --- src/Codeception/Module/REST.php | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/Codeception/Module/REST.php b/src/Codeception/Module/REST.php index 8ee96f4..e76c3a3 100644 --- a/src/Codeception/Module/REST.php +++ b/src/Codeception/Module/REST.php @@ -53,17 +53,21 @@ * headers: * Content-Type: application/json * + * ## JSONPath + * + * [JSONPath](http://goessner.net/articles/JsonPath/) is the equivalent to XPath, for querying JSON data structures. + * The following methods require that you have [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) installed: + * * [`grabDataFromResponseByJsonPath()`](#grabDataFromResponseByJsonPath) + * * [`seeResponseJsonMatchesJsonPath()`](#seeResponseJsonMatchesJsonPath) + * * [`dontSeeResponseJsonMatchesJsonPath()`](#dontSeeResponseJsonMatchesJsonPath) + * Here's an [Online JSPNPath Expressions Tester](http://jsonpath.curiousconcept.com/) + * * ## Public Properties * * * headers - array of headers going to be sent. * * params - array of sent data * * response - last response (string) * - * ## Parts - * - * * Json - actions for validating Json responses (no Xml responses) - * * Xml - actions for validating XML responses (no Json responses) - * * ## Conflicts * * Conflicts with SOAP module @@ -958,13 +962,8 @@ public function grabResponse() } /** - * Returns data from the current JSON response using [JSONPath](http://goessner.net/articles/JsonPath/) as selector. - * JsonPath is XPath equivalent for querying Json structures. - * Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). + * See [#jsonpath](#jsonpath) for general info on JSONPath. * Even for a single value an array is returned. - * - * This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**. - * * Example: * * ``` php @@ -1054,12 +1053,8 @@ public function dontSeeResponseJsonMatchesXpath($xpath) } /** - * Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/). - * JsonPath is XPath equivalent for querying Json structures. - * Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). - * This assertion allows you to check the structure of response json. - * - * This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**. + * See [#jsonpath](#jsonpath) for general info on JSONPath. + * Checks if JSON structure in response matches JSONPath. * * ```json * { "store": { @@ -1108,7 +1103,8 @@ public function seeResponseJsonMatchesJsonPath($jsonPath) } /** - * Opposite to seeResponseJsonMatchesJsonPath + * See [#jsonpath](#jsonpath) for general info on JSONPath. + * Opposite to [`seeResponseJsonMatchesJsonPath()`[#seeResponseJsonMatchesJsonPath] * * @param string $jsonPath * @part json From 75e63fea0a89ddbade17f561110138d369302740 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Mon, 26 Oct 2020 17:56:42 +0100 Subject: [PATCH 2/6] Update REST.php --- src/Codeception/Module/REST.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Codeception/Module/REST.php b/src/Codeception/Module/REST.php index e76c3a3..221b1d4 100644 --- a/src/Codeception/Module/REST.php +++ b/src/Codeception/Module/REST.php @@ -1104,7 +1104,7 @@ public function seeResponseJsonMatchesJsonPath($jsonPath) /** * See [#jsonpath](#jsonpath) for general info on JSONPath. - * Opposite to [`seeResponseJsonMatchesJsonPath()`[#seeResponseJsonMatchesJsonPath] + * Opposite to [`seeResponseJsonMatchesJsonPath()`](#seeResponseJsonMatchesJsonPath) * * @param string $jsonPath * @part json From 0f1cd1c2a4b46dd6323a1bc72f57ca610e20f41c Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Mon, 26 Oct 2020 18:02:14 +0100 Subject: [PATCH 3/6] Update REST.php --- src/Codeception/Module/REST.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Codeception/Module/REST.php b/src/Codeception/Module/REST.php index 221b1d4..e48ebce 100644 --- a/src/Codeception/Module/REST.php +++ b/src/Codeception/Module/REST.php @@ -56,7 +56,7 @@ * ## JSONPath * * [JSONPath](http://goessner.net/articles/JsonPath/) is the equivalent to XPath, for querying JSON data structures. - * The following methods require that you have [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) installed: + * The following methods require that you have [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) or [softcreatr/jsonpath](https://github.com/SoftCreatR/JSONPath) installed: * * [`grabDataFromResponseByJsonPath()`](#grabDataFromResponseByJsonPath) * * [`seeResponseJsonMatchesJsonPath()`](#seeResponseJsonMatchesJsonPath) * * [`dontSeeResponseJsonMatchesJsonPath()`](#dontSeeResponseJsonMatchesJsonPath) From e77e40f7e0b158e8b9c20348b949311d188207b1 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Thu, 5 Nov 2020 14:08:34 +0100 Subject: [PATCH 4/6] Update REST.php Updating JsonPath, according to https://github.com/Codeception/module-rest/issues/36 --- src/Codeception/Module/REST.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Codeception/Module/REST.php b/src/Codeception/Module/REST.php index e48ebce..e25505f 100644 --- a/src/Codeception/Module/REST.php +++ b/src/Codeception/Module/REST.php @@ -56,10 +56,6 @@ * ## JSONPath * * [JSONPath](http://goessner.net/articles/JsonPath/) is the equivalent to XPath, for querying JSON data structures. - * The following methods require that you have [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) or [softcreatr/jsonpath](https://github.com/SoftCreatR/JSONPath) installed: - * * [`grabDataFromResponseByJsonPath()`](#grabDataFromResponseByJsonPath) - * * [`seeResponseJsonMatchesJsonPath()`](#seeResponseJsonMatchesJsonPath) - * * [`dontSeeResponseJsonMatchesJsonPath()`](#dontSeeResponseJsonMatchesJsonPath) * Here's an [Online JSPNPath Expressions Tester](http://jsonpath.curiousconcept.com/) * * ## Public Properties From f42b8ae485d24254b8617b49c3298d8826244f71 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Thu, 5 Nov 2020 14:10:04 +0100 Subject: [PATCH 5/6] Update REST.php Bringing back the parts, according to https://github.com/Codeception/Codeception/issues/6026 --- src/Codeception/Module/REST.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Codeception/Module/REST.php b/src/Codeception/Module/REST.php index e25505f..d462383 100644 --- a/src/Codeception/Module/REST.php +++ b/src/Codeception/Module/REST.php @@ -64,6 +64,11 @@ * * params - array of sent data * * response - last response (string) * + * ## Parts + * + * * Json - actions for validating Json responses (no Xml responses) + * * Xml - actions for validating XML responses (no Json responses) + * * ## Conflicts * * Conflicts with SOAP module From ea83966d05239ad1ee6b5753c205d766ea2a7bf8 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Mon, 5 Apr 2021 12:28:25 +0300 Subject: [PATCH 6/6] Fix mistype in word JSONPath --- src/Codeception/Module/REST.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Codeception/Module/REST.php b/src/Codeception/Module/REST.php index d462383..3d30a87 100644 --- a/src/Codeception/Module/REST.php +++ b/src/Codeception/Module/REST.php @@ -56,7 +56,7 @@ * ## JSONPath * * [JSONPath](http://goessner.net/articles/JsonPath/) is the equivalent to XPath, for querying JSON data structures. - * Here's an [Online JSPNPath Expressions Tester](http://jsonpath.curiousconcept.com/) + * Here's an [Online JSONPath Expressions Tester](http://jsonpath.curiousconcept.com/) * * ## Public Properties *