Skip to content

Commit 5b257ec

Browse files
github-actions[bot]github-actions[bot]
authored andcommitted
updated
1 parent 0595ee2 commit 5b257ec

File tree

3 files changed

+70
-40
lines changed

3 files changed

+70
-40
lines changed

changelog.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,27 @@ title: Codeception Changelog
99

1010

1111

12+
### module-rest 3.4.0: 3.4.0
13+
14+
Released by [![](https://avatars.githubusercontent.com/u/64917965?v=4&s=16) TavoNiievez](https://github.com/TavoNiievez) on 2024/07/12 06:34:39 / [Repository](https://github.com/Codeception/module-rest) / [Releases](https://github.com/Codeception/module-rest/releases)
15+
16+
17+
18+
## What's Changed
19+
* Use FQN for public methods by **[erickskrauch](https://github.com/erickskrauch)** in https://github.com/Codeception/module-rest/pull/97
20+
* Changing double quotes to single quotes in the docs by **[ThomasLandauer](https://github.com/ThomasLandauer)** in https://github.com/Codeception/module-rest/pull/102
21+
* Allow softcreatr/jsonpath v0.9 + justinrainbow/json-schema v5.3 by **[W0rma](https://github.com/W0rma)** in https://github.com/Codeception/module-rest/pull/99
22+
* Test against PHP 8.2 + 8.3 by **[W0rma](https://github.com/W0rma)** in https://github.com/Codeception/module-rest/pull/101
23+
* Relax parameter types to allow filters like "array:empty" in JsonType by **[W0rma](https://github.com/W0rma)** in https://github.com/Codeception/module-rest/pull/107
24+
* Add unsetHttpHeader() + deprecate deleteHeader() by **[W0rma](https://github.com/W0rma)** in https://github.com/Codeception/module-rest/pull/106
25+
26+
## New Contributors
27+
* **[erickskrauch](https://github.com/erickskrauch)** made their first contribution in https://github.com/Codeception/module-rest/pull/97
28+
* **[W0rma](https://github.com/W0rma)** made their first contribution in https://github.com/Codeception/module-rest/pull/99
29+
30+
**Full Changelog**: https://github.com/Codeception/module-rest/compare/3.3.2...3.4.0
31+
32+
1233
### module-symfony 3.4.0: 3.4.0
1334

1435
Released by [![](https://avatars.githubusercontent.com/u/64917965?v=4&s=16) TavoNiievez](https://github.com/TavoNiievez) on 2024/06/09 13:34:44 / [Repository](https://github.com/Codeception/module-symfony) / [Releases](https://github.com/Codeception/module-symfony/releases)

docs/modules/REST.md

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Conflicts with SOAP module
8686
#### amAWSAuthenticated
8787

8888
* `param array` $additionalAWSConfig
89-
* `throws ConfigurationException`
89+
* `throws \Codeception\Exception\ConfigurationException`
9090
* `return void`
9191

9292
Allows to send REST request using AWS Authorization
@@ -152,7 +152,7 @@ Adds HTTP authentication via username/password.
152152
* `part` xml
153153
* `param string` $username
154154
* `param string` $password
155-
* `throws ModuleException`
155+
* `throws \Codeception\Exception\ModuleException`
156156
* `return void`
157157

158158
Adds NTLM authentication via username/password.
@@ -171,26 +171,10 @@ $I->amNTLMAuthenticated('jon_snow', 'targaryen');
171171

172172
#### deleteHeader
173173

174-
* `part` json
175-
* `part` xml
176-
* `param string` $name the name of the header to delete.
174+
@deprecated
175+
* `param string` $name
177176
* `return void`
178177

179-
Deletes a HTTP header (that was originally added by [haveHttpHeader()](#haveHttpHeader)),
180-
so that subsequent requests will not send it anymore.
181-
182-
Example:
183-
{% highlight php %}
184-
185-
<?php
186-
$I->haveHttpHeader('X-Requested-With', 'Codeception');
187-
$I->sendGet('test-headers.php');
188-
// ...
189-
$I->deleteHeader('X-Requested-With');
190-
$I->sendPost('some-other-page.php');
191-
192-
{% endhighlight %}
193-
194178

195179
#### dontSeeBinaryResponseEquals
196180

@@ -205,7 +189,7 @@ Checks if the hash of a binary response is not the same as provided.
205189
{% highlight php %}
206190

207191
<?php
208-
$I->dontSeeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
192+
$I->dontSeeBinaryResponseEquals('8c90748342f19b195b9c6b4eff742ded');
209193

210194
{% endhighlight %}
211195
Opposite to `seeBinaryResponseEquals`
@@ -360,7 +344,7 @@ Element is matched by either CSS or XPath
360344

361345
* `part` json
362346
* `param string` $jsonPath
363-
* `throws Exception`
347+
* `throws \Exception`
364348
* `return array` Array of matching items
365349

366350
See [#jsonpath](#jsonpath) for general info on JSONPath.
@@ -427,7 +411,7 @@ Element is matched by either CSS or XPath
427411
* `param string` $value
428412
* `return void`
429413

430-
Sets a HTTP header to be used for all subsequent requests. Use [`deleteHeader`](#deleteHeader) to unset it.
414+
Sets a HTTP header to be used for all subsequent requests. Use [`unsetHttpHeader`](#unsetHttpHeader) to unset it.
431415

432416
{% highlight php %}
433417

@@ -471,7 +455,7 @@ Example: Using sha1 hash key
471455
{% highlight php %}
472456

473457
<?php
474-
$I->seeBinaryResponseEquals("df589122eac0f6a7bd8795436e692e3675cadc3b");
458+
$I->seeBinaryResponseEquals('df589122eac0f6a7bd8795436e692e3675cadc3b');
475459

476460
{% endhighlight %}
477461

@@ -480,7 +464,7 @@ Example: Using sha1 for a file contents
480464
{% highlight php %}
481465

482466
<?php
483-
$fileData = file_get_contents("test_file.jpg");
467+
$fileData = file_get_contents('test_file.jpg');
484468
$I->seeBinaryResponseEquals(md5($fileData));
485469

486470
{% endhighlight %}
@@ -490,7 +474,7 @@ Example: Using sha256 hash
490474

491475
<?php
492476
$fileData = '/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k='; // very small jpeg
493-
$I->seeBinaryResponseEquals(hash("sha256", base64_decode($fileData)), 'sha256');
477+
$I->seeBinaryResponseEquals(hash('sha256', base64_decode($fileData)), 'sha256');
494478

495479
{% endhighlight %}
496480

@@ -672,10 +656,10 @@ $I->seeResponseIsValidOnJsonSchemaString('{"type": "object"}');
672656

673657
// response {"name": "john", "age": 20}
674658
$schema = [
675-
"properties" => [
676-
"age" => [
677-
"type" => "integer",
678-
"minimum" => 18
659+
'properties' => [
660+
'age' => [
661+
'type' => 'integer',
662+
'minimum' => 18
679663
]
680664
]
681665
];
@@ -897,6 +881,7 @@ or after another filter if you need more than one.
897881

898882
Here is the list of possible filters:
899883

884+
* `array:empty` - check that value is an empty array
900885
* `integer:>{val}` - checks that integer is greater than {val} (works with float and string types too).
901886
* `integer:<{val}` - checks that integer is lower than {val} (works with float and string types too).
902887
* `string:url` - checks that value is valid url.
@@ -955,7 +940,7 @@ Example:
955940
{% highlight php %}
956941

957942
<?php
958-
$I->seeXmlResponseIncludes("<result>1</result>");
943+
$I->seeXmlResponseIncludes('<result>1</result>');
959944

960945
{% endhighlight %}
961946

@@ -982,7 +967,7 @@ $I->seeXmlResponseMatchesXpath('//root/user[@id=1]');
982967
* `part` xml
983968
* `param string` $method
984969
* `param string` $url
985-
* `param array|string|JsonSerializable` $params
970+
* `param array|string|\JsonSerializable` $params
986971
* `param array` $files
987972

988973
Sends a HTTP request.
@@ -1065,7 +1050,7 @@ Sends an OPTIONS request to given uri.
10651050
* `part` json
10661051
* `part` xml
10671052
* `param string` $url
1068-
* `param array|string|JsonSerializable` $params
1053+
* `param array|string|\JsonSerializable` $params
10691054
* `param array` $files
10701055

10711056
Sends PATCH request to given uri.
@@ -1085,7 +1070,7 @@ $response = $I->sendPatch('/message/1', ['subject' => 'Read this!']);
10851070
* `see` https://php.net/manual/en/features.file-upload.post-method.php
10861071
* `see` codecept_data_dir()
10871072
* `param string` $url
1088-
* `param array|string|JsonSerializable` $params
1073+
* `param array|string|\JsonSerializable` $params
10891074
* `param array` $files A list of filenames or "mocks" of $_FILES (each entry being an array with the following
10901075
keys: name, type, error, size, tmp_name (pointing to the real file path). Each key works
10911076
as the "name" attribute of a file input field.
@@ -1125,7 +1110,7 @@ $I->sendPost('/add-task', ['form' => [
11251110
* `part` json
11261111
* `part` xml
11271112
* `param string` $url
1128-
* `param array|string|JsonSerializable` $params
1113+
* `param array|string|\JsonSerializable` $params
11291114
* `param array` $files
11301115

11311116
Sends PUT request to given uri.
@@ -1198,4 +1183,27 @@ $I->stopFollowingRedirects();
11981183

11991184
{% endhighlight %}
12001185

1186+
1187+
#### unsetHttpHeader
1188+
1189+
* `part` json
1190+
* `part` xml
1191+
* `param string` $name the name of the header to unset.
1192+
* `return void`
1193+
1194+
Unsets a HTTP header (that was originally added by [haveHttpHeader()](#haveHttpHeader)),
1195+
so that subsequent requests will not send it anymore.
1196+
1197+
Example:
1198+
{% highlight php %}
1199+
1200+
<?php
1201+
$I->haveHttpHeader('X-Requested-With', 'Codeception');
1202+
$I->sendGet('test-headers.php');
1203+
// ...
1204+
$I->unsetHttpHeader('X-Requested-With');
1205+
$I->sendPost('some-other-page.php');
1206+
1207+
{% endhighlight %}
1208+
12011209
<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/module-rest/tree/master/src/Codeception/Module/REST.php">Help us to improve documentation. Edit module reference</a></div>

docs/reference/JsonType.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ Usage example:
1818
{% highlight php %}
1919

2020
<?php
21-
$jsonType = new JsonType(['name' => 'davert', 'id' => 1]);
21+
$jsonType = new JsonType(['name' => 'davert', 'id' => 1, 'data' => []]);
2222
$jsonType->matches([
2323
'name' => 'string:!empty',
2424
'id' => 'integer:>0|string:>0',
25+
'data' => 'array:empty',
2526
]); // => true
2627

2728
$jsonType->matches([
@@ -46,7 +47,7 @@ Pass an array or `\Codeception\Util\JsonArray` with data.
4647

4748
If non-associative array is passed - the very first element of it will be used for matching.
4849

49-
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L47)
50+
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L48)
5051

5152
#### addCustomFilter()
5253

@@ -80,7 +81,7 @@ JsonType::addCustomFilter('/len\((.*?)\)/', function($value, $len) {
8081

8182
{% endhighlight %}
8283

83-
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L77)
84+
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L78)
8485

8586
#### cleanCustomFilters()
8687

@@ -91,7 +92,7 @@ JsonType::addCustomFilter('/len\((.*?)\)/', function($value, $len) {
9192

9293
Removes all custom filters
9394

94-
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L85)
95+
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L86)
9596

9697
#### matches()
9798

@@ -106,6 +107,6 @@ Checks data against passed JsonType.
106107
If matching fails function returns a string with a message describing failure.
107108
On success returns `true`.
108109

109-
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L95)
110+
[See source](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php#L96)
110111

111112
<p>&nbsp;</p><div class="alert alert-warning">Reference is taken from the source code. <a href="https://github.com/Codeception/module-rest/blob/master/src/Codeception/Util/JsonType.php">Help us to improve documentation. Edit module reference</a></div>

0 commit comments

Comments
 (0)