| @@ 15-28 (lines=14) @@ | ||
| 12 | /** |
|
| 13 | * tests if the argument-exception object is correctly filled |
|
| 14 | */ |
|
| 15 | public function testArgumentException() |
|
| 16 | { |
|
| 17 | $util = $this->createUtil($this->createGuzzleClient(http_build_query([ |
|
| 18 | 'errorCode' => -2, |
|
| 19 | 'errorItem' => 'field', |
|
| 20 | 'errorMessage' => 'InvalidRequest', |
|
| 21 | ]))); |
|
| 22 | ||
| 23 | try { |
|
| 24 | $util->autoApplySSL([]); |
|
| 25 | } catch (ArgumentException $e) { |
|
| 26 | $this->assertEquals('field', $e->getArgumentName()); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * tests, if the common exception fields are filled |
|
| @@ 33-46 (lines=14) @@ | ||
| 30 | /** |
|
| 31 | * tests, if the common exception fields are filled |
|
| 32 | */ |
|
| 33 | public function testCommonException() |
|
| 34 | { |
|
| 35 | $util = $this->createUtil($this->createGuzzleClient(http_build_query([ |
|
| 36 | 'errorCode' => -15, |
|
| 37 | 'errorMessage' => 'Invalid Request', |
|
| 38 | ]))); |
|
| 39 | ||
| 40 | try { |
|
| 41 | $util->autoApplySSL([]); |
|
| 42 | } catch (AccountException $e) { |
|
| 43 | $this->assertEquals($e->getMessage(), 'Invalid Request'); |
|
| 44 | $this->assertEquals(-15, $e->getCode()); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||