单元测试:我把同一个接口但是不同的参数请求都写到一个方法里面合理吗?
class InvoiceTest extends TestCase
{
/**
* 申请发票
*
* @return void
*/
public function testApplyInvoice()
{
$response = $this->post('/car/gas/v1/detail_v2', [
'user_id' => 5000000,
'gas_id' => 1001,
]);
$response->assertStatus(200)
->assertJsonStructure([
'ciphertext',
])
->dump();
$response = $this->post('/car/gas/v1/detail_v2', [
'xxx' => 'xxx'
]);
$response->assertStatus(200)
->assertJsonStructure([
'ciphertext',
])
->dump();
}
}
测试而已 当然合理
也可以用数据供给器 代替