@@ -45,14 +45,22 @@ Otherwise, a PHPBrowser should be specified as a dependency to send requests and
4545
4646This module requires PHPBrowser or any of Framework modules enabled.
4747
48+ In case you need to configure low-level HTTP fields, that's done on the PHPBrowser level.
49+ Check the example below for details.
50+
4851#### Example
4952
5053 modules:
5154 enabled:
5255 - REST:
5356 depends: PhpBrowser
54- url: 'http://serviceapp/api/v1/'
57+ url: &url 'http://serviceapp/api/v1/' # you only need the &url anchor for further PhpBrowser configs
5558 shortDebugResponse: 300 # only the first 300 chars of the response
59+ config:
60+ PhpBrowser:
61+ url: *url # repeats the URL from the REST module; not needed if you don't have further settings like below
62+ headers:
63+ Content-Type: application/json
5664
5765### Public Properties
5866
@@ -745,9 +753,9 @@ $I->seeResponseJsonMatchesXpath('/store//price');
745753
746754#### seeResponseMatchesJsonType
747755
748- Checks that Json matches provided types.
756+ Checks that JSON matches provided types.
749757In case you don't know the actual values of JSON data returned you can match them by type.
750- Starts check with a root element. If JSON data is array it will check the first element of an array .
758+ It starts the check with a root element. If JSON data is an array it will check all elements of it .
751759You can specify the path in the json which should be checked with JsonPath
752760
753761Basic example:
@@ -769,16 +777,17 @@ $I->seeResponseMatchesJsonType(['name' => 'string'], '$.users[0]');
769777
770778{% endhighlight %}
771779
772- In this case you can match that record contains fields with data types you expected .
780+ You can check if the record contains fields with the data types you expect .
773781The list of possible data types:
774782
775783* string
776784* integer
777785* float
778786* array (json object is array as well)
779787* boolean
788+ * null
780789
781- You can also use nested data type structures:
790+ You can also use nested data type structures, and define multiple types for the same field :
782791
783792{% highlight php %}
784793
@@ -792,7 +801,8 @@ $I->seeResponseMatchesJsonType([
792801
793802{% endhighlight %}
794803
795- You can also apply filters to check values. Filter can be applied with ` : ` char after the type declaration.
804+ You can also apply filters to check values. Filter can be applied with a ` : ` char after the type declaration,
805+ or after another filter if you need more than one.
796806
797807Here is the list of possible filters:
798808
@@ -817,17 +827,18 @@ $I->seeResponseMatchesJsonType([
817827// {'user_id': '1'}
818828$I->seeResponseMatchesJsonType([
819829 'user_id' => 'string:>0', // works with strings as well
820- }
830+ ]);
821831?>
822832
823833{% endhighlight %}
824834
825- You can also add custom filters y accessing ` JsonType::addCustomFilter ` method .
835+ You can also add custom filters by using ` {@link JsonType::addCustomFilter()} ` .
826836See [ JsonType reference] ( http://codeception.com/docs/reference/JsonType ) .
827837
828838 * ` [Part] ` json
829839 * ` param array ` $jsonType
830840 * ` param string ` $jsonPath
841+ @see JsonType
831842 * ` Available since ` 2.1.3
832843
833844
0 commit comments