Can phpunit use multiple data provider

前端 未结 5 725
渐次进展
渐次进展 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:15

    You can add a comment to your dataProvider array, to provide the same functionality, while not requiring multiple dataProviders.

    public static function DataProvider()
    {
        return array(
            'Invalid Id'      => array(123),
            'Failed Id'       => array(321),
            'Id Not Provided' => array(NULL),
    );
    }
    

提交回复
热议问题