Skip to content

Commit 8b7bf17

Browse files
Use sendGet and sendPost in 10-APITesting.md (#352)
See Codeception/module-rest#28
1 parent 81e848b commit 8b7bf17

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/10-APITesting.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class CreateUserCest
8282
{
8383
$I->amHttpAuthenticated('service_user', '123456');
8484
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
85-
$I->sendPOST('/users', [
85+
$I->sendPost('/users', [
8686
'name' => 'davert',
8787
'email' => 'davert@codeception.com'
8888
]);
@@ -131,26 +131,26 @@ $I->haveHttpHeader('content-type', 'application/json');
131131

132132
{% endhighlight %}
133133

134-
When headers are set, you can send a request. To obtain data use `sendGET`:
134+
When headers are set, you can send a request. To obtain data use `sendGet`:
135135

136136
{% highlight php %}
137137

138138
<?php
139139
// pass in query params in second argument
140-
$I->sendGET('/posts', [ 'status' => 'pending' ]);
140+
$I->sendGet('/posts', [ 'status' => 'pending' ]);
141141
$I->seeResponseCodeIs(200);
142142
$I->seeResponseIsJson();
143143

144144
{% endhighlight %}
145145

146-
> `sendGET` won't return any value. However, you can access data from a response and perform assertions using other available methods of REST module.
146+
> `sendGet` won't return any value. However, you can access data from a response and perform assertions using other available methods of REST module.
147147

148148
To create or update data you can use other common methods:
149149

150-
* `sendPOST`
151-
* `sendPUT`
152-
* `sendDELETE`
153-
* `sendPATCH`
150+
* `sendPost`
151+
* `sendPut`
152+
* `sendDelete`
153+
* `sendPatch`
154154

155155
### JSON Structure Validation
156156

@@ -159,7 +159,7 @@ If we expect a JSON response to be received we can check its structure with [JSO
159159
{% highlight php %}
160160

161161
<?php
162-
$I->sendGET('/users');
162+
$I->sendGet('/users');
163163
$I->seeResponseCodeIs(HttpCode::OK); // 200
164164
$I->seeResponseIsJson();
165165
$I->seeResponseJsonMatchesJsonPath('$[0].user.login');
@@ -173,7 +173,7 @@ You can do that by using with a [seeResponseMatchesJsonType](http://codeception.
173173
{% highlight php %}
174174

175175
<?php
176-
$I->sendGET('/users/1');
176+
$I->sendGet('/users/1');
177177
$I->seeResponseCodeIs(HttpCode::OK); // 200
178178
$I->seeResponseIsJson();
179179
$I->seeResponseMatchesJsonType([
@@ -198,7 +198,7 @@ When you need to obtain a value from a response and use it in next requests you
198198

199199
<?php
200200
list($id) = $I->grabDataFromResponseByJsonPath('$.id');
201-
$I->sendGET('/pet/' . $id);
201+
$I->sendGet('/pet/' . $id);
202202

203203
{% endhighlight %}
204204

@@ -252,7 +252,7 @@ There is `seeXmlResponseIncludes` method to match inclusion of XML parts in resp
252252
{% highlight php %}
253253

254254
<?php
255-
$I->sendGET('/users.xml');
255+
$I->sendGet('/users.xml');
256256
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); // 200
257257
$I->seeResponseIsXml();
258258
$I->seeXmlResponseMatchesXpath('//user/login');
@@ -390,4 +390,4 @@ Codeception has two modules that will help you to test various web services. The
390390

391391

392392
* **Next Chapter: [Codecoverage >](/docs/11-Codecoverage)**
393-
* **Previous Chapter: [< Data](/docs/09-Data)**
393+
* **Previous Chapter: [< Data](/docs/09-Data)**

0 commit comments

Comments
 (0)