Skip to content

Commit

Permalink
Fix docs testing
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Apr 6, 2024
1 parent 961992f commit bfeb5a6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ $request = $request->withQueryParams($params);
### Add BasicAuth to the request

```php
$request = $this->withHttpBasicAuth($request);
$credentials = base64_encode('username:password');
$request = $request->withHeader('Authorization', sprintf('Basic %s', $credentials));
```

### Invoking a request
Expand All @@ -110,13 +111,15 @@ $this->assertJsonContentType($response);
Asserting JSON response data:

```php
$this->assertJsonData($response, [
$expected = [
'user_id' => 1,
'username' => 'admin',
'first_name' => 'John',
'last_name' => 'Doe',
'email' => '[email protected]',
]);
];

$this->assertJsonData($expected, $response);
```

You can find more examples in: `tests/TestCase/Action/`
Expand Down

0 comments on commit bfeb5a6

Please sign in to comment.