我正在尝试为测试用例生成覆盖率报告,但是我发现@covers函数包含在覆盖率中的某些功能并不是我的测试用例下面的全部。
覆盖率报告未涵盖
/**
* @depends testCreateBorrower
* @covers \App\Borrower::getDetails
*/
public function testBorrowerGetDetails($data)
{
fwrite(STDOUT, "\nExecuting testBorrowerGetDetails ...");
$borrowerObject = new Borrower();
$result = $borrowerObject->getDetails([],$data);
$this->assertTrue($result['code'] == 200);
}
覆盖率报告中
/**
* @covers \App\UserType::getUserType
*/
public function testGetUserType()
{
fwrite(STDOUT, "\nExecuting testGetUserType ...");
$userTypeModel = new UserType();
$faker = \Faker\Factory::create();
$result = $userTypeModel->getUserType((object)['user_type_id'=>$faker->numberBetween(1,5)]);
$this->assertNotNull($result);
return $result;
}
两个功能都相同,但是1个正在工作,另一个不在覆盖范围内。