@@ -1393,7 +1393,7 @@ Testing
1393
1393
This component includes the ``MockHttpClient `` and ``MockResponse `` classes to
1394
1394
use in tests that shouldn't make actual HTTP requests. Such tests can be
1395
1395
useful, as they will run faster and produce consistent results, since they're
1396
- not dependant on an external service. By not making actual HTTP requests there
1396
+ not dependent on an external service. By not making actual HTTP requests there
1397
1397
is no need to worry about the service being online or the request changing
1398
1398
state, for example deleting a resource.
1399
1399
@@ -1469,12 +1469,10 @@ However, using ``MockResponse`` allows simulating chunked responses and timeouts
1469
1469
Testing Request Data
1470
1470
~~~~~~~~~~~~~~~~~~~~
1471
1471
1472
- The examples above describe how to return desired response. What if you wanted
1473
- to also test the request itself? ``MockResponse `` comes with a few helper
1474
- methods:
1472
+ The ``MockResponse `` class comes with some helper methods to test the request:
1475
1473
1476
- * ``getRequestMethod() `` - returns the HTTP method
1477
- * ``getRequestUrl() `` - returns the URL the request would be sent to
1474
+ * ``getRequestMethod() `` - returns the HTTP method;
1475
+ * ``getRequestUrl() `` - returns the URL the request would be sent to;
1478
1476
* ``getRequestOptions() `` - returns an array containing other information about
1479
1477
the request such as headers, query parameters, body content etc.
1480
1478
@@ -1490,19 +1488,19 @@ Usage example::
1490
1488
],
1491
1489
]);
1492
1490
1493
- // returns "DELETE"
1494
1491
$mockResponse->getRequestMethod();
1492
+ // returns "DELETE"
1495
1493
1496
- // returns "https://example.com/api/article/1337"
1497
1494
$mockResponse->getRequestUrl();
1495
+ // returns "https://example.com/api/article/1337"
1498
1496
1499
- // returns ["Accept: */*", "Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l"]
1500
1497
$mockResponse->getRequestOptions()['headers'];
1498
+ // returns ["Accept: */*", "Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l"]
1501
1499
1502
- Example
1503
- ~~~~~~~
1500
+ Full Example
1501
+ ~~~~~~~~~~~~
1504
1502
1505
- The following standalone example demonstrates a way to use HTTP client and
1503
+ The following standalone example demonstrates a way to use the HTTP client and
1506
1504
test it in a real application::
1507
1505
1508
1506
// ExternalArticleService.php
0 commit comments