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

前端 未结 5 1625
礼貌的吻别
礼貌的吻别 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:23

    If you name your method not with test at the beginning then the method will not be executed by PHPUnit (see here).

    public function willBeIgnored() {
        ...
    }
    
    public function testWillBeExecuted() {
        ...
    }
    

    If you want a method to be executed which does not start with test you can add the annotation @test to execute it anyway.

    /**
     * @test
     */
    public function willBeExecuted() {
        ...
    }
    

提交回复
热议问题