How can I ignore a test method in phpunit without modifying its content?

前端 未结 5 1623
礼貌的吻别
礼貌的吻别 2021-02-06 23:43

What is the attribute that should be placed next to the PHP test method in order to ignore the test using PHPUnit ?

I know that for NUnit the attribute is :



        
5条回答
  •  既然无缘
    2021-02-07 00:22

    Since you suggested in one of your comments that you do not want to change the content of a test, if you are willing to add or adjust annotations, you could abuse the @requires annotation to ignore tests:

    assertFalse(true);
        }
    }
    

    Note This will only work until PHP 9000 is released, and the output from running the tests will be a bit misleading, too:

    There was 1 skipped test:
    
    1) FooTest::testThatShouldBeSkipped
    PHP >= 9000 is required.
    

    For reference, see:

    • https://phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests-using-requires

提交回复
热议问题