我使用Phpunit编写了一些测试用例。
当我在控制台中执行它们时,其中一个测试失败了。 所以我在cli上使用xdebug和phpstorm。代码执行正确,测试通过。没有代码更改。我彻底完成了代码似乎没有错误。
如果有的话,任何人都会遇到类似的问题。
public function testGetAccruedDaysFromProcessDateBeginning() {
$annualLeaveType = $this->getLeaveTypeService()->readLeaveType(1);
$leaveTypeRule = $this->getLeaveTypeRuleService()->readLeaveTypeRule($annualLeaveType);
$leaveEntitlementRule = $leaveTypeRule->getLeaveEntitlementRule();
$employee = $this->getEmployeeService()->getEmployee(1);
$accruedDaysCount = $this->getLeaveEntitlementProcessor()->getAccruedDaysFromProcessDate($employee, $leaveEntitlementRule, '2015-01-01');
$this->assertEquals(15, $accruedDaysCount);
}
public function testGetAccruedDaysFromProcessDateEnd() {
$annualLeaveType = $this->getLeaveTypeService()->readLeaveType(1);
$leaveTypeRule = $this->getLeaveTypeRuleService()->readLeaveTypeRule($annualLeaveType);
$leaveEntitlementRule = $leaveTypeRule->getLeaveEntitlementRule();
$employee = $this->getEmployeeService()->getEmployee(1);
$accruedDaysCount = $this->getLeaveEntitlementProcessor()->getAccruedDaysFromProcessDate($employee, $leaveEntitlementRule, '2015-12-31');
$this->assertEquals(16, $accruedDaysCount);
}