phpunit filter blocker
1.0.0
PHPUnitFilterBlocker 是 PHPUnit 框架 TestListener 的自訂實作。它主要阻止 PHPUnit 的過濾選項,以防止 CI 中的錯誤配置。
$ composer require genkiroid/phpunit-filter-blocker
若要將 PHPUnitFilterBlocker 附加為測試偵聽器,請將下列元素新增至 phpunit.xml。 (父元素是
。)
< listeners >
< listener class = " PHPUnitFilterBlockerListener " >
< arguments >
< array >
< element key = " blockGroup " >
< boolean >false boolean >
element >
< element key = " blockExcludeGroup " >
< boolean >false boolean >
element >
array >
arguments >
listener >
listeners >
如果您也想封鎖--group
和--exclude-group
選項,請將上面的設定值false
變更為true
。
塊測試用例規格。 (固定的)
$ vendor/bin/phpunit tests/exampleTest.php
PHPUnit 9.0.1 by Sebastian Bergmann and contributors.
Test case specification has been disabled by phpunit-filter-blocker. Stopped phpunit.
阻止--filter
選項。 (固定的)
$ vendor/bin/phpunit tests/ --filter="Hello"
PHPUnit 9.0.1 by Sebastian Bergmann and contributors.
--filter option has been disabled by phpunit-filter-blocker. Stopped phpunit.
封鎖--group
選項。 (選項)
$ vendor/bin/phpunit tests/ --group=hello
PHPUnit 9.0.1 by Sebastian Bergmann and contributors.
--group option has been disabled by phpunit-filter-blocker. Stopped phpunit.
阻止--exclude-group
選項。 (選項)
$ vendor/bin/phpunit tests/ --exclude-group=hello
PHPUnit 9.0.1 by Sebastian Bergmann and contributors.
--exclude-group option has been disabled by phpunit-filter-blocker. Stopped phpunit.
沒有阻塞範例。
$ vendor/bin/phpunit tests/
PHPUnit 9.0.1 by Sebastian Bergmann and contributors.
.. 2 / 2 (100%)
Time: 83 ms, Memory: 6.00 MB
OK (2 tests, 2 assertions)