| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 12 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class ChainOfResponsibilityTest extends PHPUnit_Framework_TestCase |
||
| 14 | { |
||
| 15 | protected ChainInterface $chain; |
||
| 16 | |||
| 17 | protected function setUp(): void |
||
| 18 | { |
||
| 19 | $this->chain = new NoticeHandler(); |
||
| 20 | $this->chain->setNext(new WarningHandler())->setNext(new ErrorHandler); |
||
|
|
|||
| 21 | } |
||
| 22 | |||
| 23 | public function testNoticeHandler(): void |
||
| 24 | { |
||
| 25 | ob_start(); |
||
| 26 | $this->chain->execute(NoticeHandler::class); |
||
| 27 | $notice = ob_get_clean(); |
||
| 28 | |||
| 29 | $this->assertEquals($notice, NoticeHandler::class . " has handle an error\n"); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function testWarningHandler(): void |
||
| 33 | { |
||
| 34 | ob_start(); |
||
| 35 | $this->chain->execute(WarningHandler::class); |
||
| 36 | $warning = ob_get_clean(); |
||
| 37 | |||
| 38 | $this->assertEquals($warning, WarningHandler::class . " has handle an error\n"); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function testErrorHandler(): void |
||
| 48 | } |
||
| 49 | } |
||
| 50 |