Skip to content

Commit

Permalink
Deprecate pasteAccount() according to HIBP API
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Aug 19, 2019
1 parent ddc117a commit 96dffbe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

### [2.1.2](https://github.com/webeweb/haveibeenpwned-library/tree/v2.1.2) (2019-08-19)

> IMPORTANT NOTICE:
>
> - WBW\Library\HaveIBeenPwned\Provider\APIv2Provider::pasteAccount() is now deprecated
### [2.1.1](https://github.com/webeweb/haveibeenpwned-library/tree/v2.1.1) (2019-08-08)

- Fix log level
Expand Down
1 change: 1 addition & 0 deletions src/Provider/APIv2Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function getEndpointVersion() {
* @return PastesResponse Returns the pastes response.
* @throws APIException Throws an API exception if an error occurs.
* @throws InvalidArgumentException Throws an invalid argument exception if a parameter is missing.
* @deprecated since 2.1.2 use "WBW\Library\HaveIBeenPwned\Provider\APIv3Provider" instead.
*/
public function pasteAccount(PasteAccountRequest $pasteAccountRequest) {

Expand Down
12 changes: 9 additions & 3 deletions tests/Provider/APIv2ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace WBW\Library\HaveIBeenPwned\Tests\Provider;

use Exception;
use WBW\Library\HaveIBeenPwned\API\RequestInterface;
use WBW\Library\HaveIBeenPwned\Exception\APIException;
use WBW\Library\HaveIBeenPwned\Model\Request\BreachedAccountRequest;
use WBW\Library\HaveIBeenPwned\Model\Request\BreachesRequest;
Expand Down Expand Up @@ -173,8 +172,15 @@ public function testPasteAccount() {

$obj = new APIv2Provider();

$res = $obj->pasteAccount($pasteAccountRequest);
$this->assertInstanceOf(PastesResponse::class, $res);
try {

$res = $obj->pasteAccount($pasteAccountRequest);
$this->assertInstanceOf(PastesResponse::class, $res);
} catch (Exception $ex) {

$this->assertInstanceOf(APIException::class, $ex);
$this->assertEquals(401, $ex->getPrevious()->getCode());
}
}

/**
Expand Down

0 comments on commit 96dffbe

Please sign in to comment.