| 1 | <?php namespace Phprest\Entity; |
||
| 6 | class ErrorTest extends TestCase |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * @var Error |
||
| 10 | */ |
||
| 11 | protected $error; |
||
| 12 | |||
| 13 | public function setUp() |
||
| 14 | { |
||
| 15 | $this->error = new Error(new \Exception('exception message', 101)); |
||
| 16 | } |
||
| 17 | |||
| 18 | public function testGetCode(): void |
||
| 19 | { |
||
| 20 | $this->assertEquals(101, $this->error->getCode()); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function testGetMessage(): void |
||
| 24 | { |
||
| 25 | $this->assertEquals('exception message', $this->error->getMessage()); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function testGetDetails(): void |
||
| 29 | { |
||
| 30 | $error = new Error(new Exception('', 0, 500, ['details'])); |
||
| 31 | |||
| 32 | $this->assertEquals(['details'], $error->getDetails()); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |