| 1 | <?php |
||||||
| 2 | |||||||
| 3 | /** |
||||||
| 4 | * @author : Jagepard <[email protected]> |
||||||
| 5 | * @license https://mit-license.org/ MIT |
||||||
| 6 | */ |
||||||
| 7 | |||||||
| 8 | namespace Behavioral\ChainOfResponsibility\Tests; |
||||||
| 9 | |||||||
| 10 | use Behavioral\ChainOfResponsibility\{ChainInterface, ErrorHandler, NoticeHandler, WarningHandler}; |
||||||
| 11 | use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 12 | |||||||
| 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); |
||||||
|
0 ignored issues
–
show
The method
setNext() does not exist on Behavioral\ChainOfResponsibility\ChainInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Behavioral\ChainOfResponsibility\ChainInterface.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 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 a request\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 a request\n"); |
||||||
| 39 | } |
||||||
| 40 | |||||||
| 41 | public function testErrorHandler(): void |
||||||
| 42 | { |
||||||
| 43 | ob_start(); |
||||||
| 44 | $this->chain->execute(ErrorHandler::class); |
||||||
| 45 | $error = ob_get_clean(); |
||||||
| 46 | |||||||
| 47 | $this->assertEquals($error, ErrorHandler::class . " has handle a request\n"); |
||||||
| 48 | } |
||||||
| 49 | |||||||
| 50 | public function testAllNoticeHandler(): void |
||||||
| 51 | { |
||||||
| 52 | ob_start(); |
||||||
| 53 | $this->chain->execute(NoticeHandler::class, true); |
||||||
| 54 | $notice = ob_get_clean(); |
||||||
| 55 | |||||||
| 56 | $this->assertEquals($notice, NoticeHandler::class . " has handle a request\n"); |
||||||
| 57 | } |
||||||
| 58 | |||||||
| 59 | public function testAllWarningHandler(): void |
||||||
| 60 | { |
||||||
| 61 | ob_start(); |
||||||
| 62 | $this->chain->execute(WarningHandler::class, true); |
||||||
| 63 | $warning = ob_get_clean(); |
||||||
| 64 | |||||||
| 65 | $this->assertEquals($warning, |
||||||
| 66 | NoticeHandler::class . " has handle a request\n" |
||||||
| 67 | . WarningHandler::class . " has handle a request\n" |
||||||
| 68 | ); |
||||||
| 69 | } |
||||||
| 70 | |||||||
| 71 | public function testAllErrorHandler(): void |
||||||
| 72 | { |
||||||
| 73 | ob_start(); |
||||||
| 74 | $this->chain->execute(ErrorHandler::class, true); |
||||||
| 75 | $error = ob_get_clean(); |
||||||
| 76 | |||||||
| 77 | $this->assertEquals($error, |
||||||
| 78 | NoticeHandler::class . " has handle a request\n" |
||||||
| 79 | . WarningHandler::class . " has handle a request\n" |
||||||
| 80 | . ErrorHandler::class . " has handle a request\n" |
||||||
| 81 | ); |
||||||
| 82 | } |
||||||
| 83 | } |
||||||
| 84 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths