I have following, very simple, XML config for PHPUnit:
<phpunit bootstrap="/_tests/TestAutoload.php"> <testsuites> <testsuite name="Unit Tests"> <directory suffix=".php">_tests</directory> </testsuite> </testsuites> </phpunit>
How to exclude certain file in this directory from test suite? I tried <exclude>
and <blacklist>
, but it doesn't seem to work in this context. Also couldn't find any other documentation than phpunit.de one, which doesn't mention anything about it. Else than that, this config works perfectly.
The <phpunit> Element.
In Testing array operations with PHPUnit, the fixture was the array that is stored in the $stack variable. Most of the time, though, the fixture will be more complex than a simple array, and the amount of code needed to set it up will grow accordingly.
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks. The currently supported versions are PHPUnit 9 and PHPUnit 8.
To exclude the file name TestCase.php
.
add this to your phpunit.xml
<testsuites> <testsuite name="BLABLA"> <directory suffix=".php">./tests</directory> <exclude>./tests/TestCase.php</exclude> </testsuite> </testsuites>
Here is an additional excerpt from a real-live test-suite I can confirm it working with:
... <testsuites> <testsuite name="n98-magerun-tests"> <directory>./tests</directory> <exclude>tests/N98/Magento/Command/Installer/UninstallCommandTest.php</exclude> </testsuite> ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With