Skip to content

Commit

Permalink
Add energize alias for send()
Browse files Browse the repository at this point in the history
  • Loading branch information
craigpotter committed Oct 2, 2021
1 parent c78b7e9 commit 0ac7406
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ When building your request to send, you can override the following:
- Request Query Params using `withQuery(array $query)`
- Request Path using `setPath(string $path)`

### Optional Alias

Instead of the standard `send()` method, it is also possible to use the fun alias `energize()`. *Please note, no sound effects are included.*

```php
TestRequest::build()
->withToken('foobar')
->withData([
'title' => 'Build a package'
])
->energize()
->json();
```

### Faking a Request

Expand Down
5 changes: 5 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ protected function fakeResponse(): Psr7Response
);
}

public function energize(): Response
{
return $this->send();
}

public function send(): Response
{
if ($this->useFake) {
Expand Down

0 comments on commit 0ac7406

Please sign in to comment.