| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | protected function catchExpectedException(string $exception, \Closure $callback) : \Exception { |
||
| 10 | |||
| 11 | try { |
||
| 12 | $callback(); |
||
| 13 | } catch (\Exception $e) { |
||
| 14 | $this->assertEquals( |
||
| 15 | $exception, |
||
| 16 | get_class($e), |
||
| 17 | 'Exception message: ' . $e->getMessage(), |
||
| 18 | ); |
||
| 19 | return $e; |
||
| 20 | } |
||
| 21 | |||
| 22 | throw new \RuntimeException('Expected exception not thrown: ' . $exception); |
||
| 23 | } |
||
| 24 | } |