phpunit filter blocker
1.0.0
PHPUnitFilterBlocker es una implementación personalizada de PHPUnit Framework TestListener. Principalmente bloquea la opción de filtro de PHPUnit para evitar una mala configuración en CI.
$ composer require genkiroid/phpunit-filter-blocker
Para adjuntar PHPUnitFilterBlocker como escucha de prueba, agregue el siguiente elemento a phpunit.xml. (El elemento principal es
.)
< listeners >
< listener class = " PHPUnitFilterBlockerListener " >
< arguments >
< array >
< element key = " blockGroup " >
< boolean >false boolean >
element >
< element key = " blockExcludeGroup " >
< boolean >false boolean >
element >
array >
arguments >
listener >
listeners >
Si también desea bloquear las opciones --group
y --exclude-group
, cambie el valor de configuración de false
a true
anterior.
Especificación del caso de prueba de bloque. (Fijado)
$ 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.
Bloquear la opción --filter
. (Fijado)
$ 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.
Bloquear opción --group
. (Opción)
$ 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.
Bloquear la opción --exclude-group
. (Opción)
$ 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.
Sin ejemplo de bloqueo.
$ 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)