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
You can use a helper function as shown below. The only problem is if the total number of test cases provided by all "sub data providers" is large, it can be tedious to figure out which test case is causing a problem.
/**
* @dataProvider allIds
*/
public function testGetByIdUnsuccess($id)
{
$this->assertNull($this->model->getById($id));
}
public function allIds()
{
return array_merge(provideInvalidId(),provideFailedId());
}