Level 80
@kdev Why? It makes far more sense to co-locate the data provider with the test case method that actually uses it.
Hi.. I am wondering if its possible to write the data provider on another class instead of another method inside the test class..
answering my question.. here is what I did.
/**
* @test
* @param array $params
* @dataProvider \Tests\DataProviders\SampleDataProvider::createEndpointDataProvider
*/
public function test_create_endpoint(array $params)
{
$request = $this->post('v1/endpoint', $params);
self::assertEquals(200, $request->response->status());
self::seeInDatabase('table_name', $params);
self::seeJsonStructure([
'id',
'name',
'user_id',
]);
}
Please or to participate in this conversation.