@cali_green
There are a few different ways to skip certain tests in PHPUnit:
1 2 3 4 5 6 7 8 9 10 11 12 |
public function test1(): void { $this->markTestSkipped('This test is skipped for now.'); } /** * @group slow */ public function test2(): void { // Test implementation } |
To skip the test1
test method, you can run PHPUnit with the --exclude-group slow
command line option.
1 2 3 4 5 6 7 |
/** * @requires extension mysql */ public function test(): void { // Test implementation that requires the "mysql" extension } |
The test will be skipped if the mysql
extension is not available.
1 2 3 4 5 6 7 8 |
public function test(): void { if (!extension_loaded('mysql')) { $this->markTestSkipped('This test requires the "mysql" extension.'); } // Test implementation } |
The test will be skipped if the mysql
extension is not available.
These are some of the ways you can skip certain tests in PHPUnit. Choose the one that best suits your needs based on the specific conditions you want to skip the tests for.