Can phpunit use multiple data provider

前端 未结 5 855
渐次进展
渐次进展 2021-02-06 22:50

One question in short: can phpunit use multiple data provider when running test?

For example, I have a method called getById, and I need to run both successful and unsuc

5条回答
  •  自闭症患者
    2021-02-06 23:18

    You can also use CrossDataProviders which allows you to use a combination of data providers with each other

    assertNull($this->model->getById($id));
    }   
    
    function provideInvalidIdAndValues() {
        return DataProviders::cross(
            [[1], [2], [3]],
            [['Rob'], ['John'], ['Dennis']]
        );
    }
    

提交回复
热议问题