Conditions | 2 |
Paths | 3 |
Total Lines | 8 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Chekote\PHPUnit\Framework; |
||
22 | public function assertException(Exception $expected, callable $lambda): void |
||
23 | { |
||
24 | try { |
||
25 | $lambda(); |
||
26 | $this->fail(get_class($expected) . ' was not thrown'); |
||
27 | } catch (Throwable | Exception $actual) { |
||
28 | $this->assertThat($actual, new PHPUnit_Framework_Constraint_Exception(get_class($expected))); |
||
29 | $this->assertThat($actual, new PHPUnit_Framework_Constraint_ExceptionMessage($expected->getMessage())); |
||
30 | } |
||
33 |