Skip to content

Commit

Permalink
Merge pull request #23 from Soullivaneuh/last-elements
Browse files Browse the repository at this point in the history
Add Client::getLastRequest
  • Loading branch information
dbu committed Jan 4, 2018
2 parents 5edc24d + cafad97 commit 51322eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@

- Default response functionality
- Default exception functionality
- `getLastRequest` method

## 1.0.1 - 2017-05-02

Expand Down
7 changes: 7 additions & 0 deletions spec/ClientSpec.php
Expand Up @@ -66,4 +66,11 @@ function it_creates_an_empty_response_when_none_is_added(

$this->sendRequest($request)->shouldReturn($response);
}

function it_returns_the_last_request(RequestInterface $request)
{
$this->sendRequest($request);

$this->getLastRequest()->shouldReturn($request);
}
}
8 changes: 8 additions & 0 deletions src/Client.php
Expand Up @@ -140,4 +140,12 @@ public function getRequests()
{
return $this->requests;
}

/**
* @return RequestInterface|false
*/
public function getLastRequest()
{
return end($this->requests);
}
}

0 comments on commit 51322eb

Please sign in to comment.