public function testCreateNextLeavePeriodNotAlreadyCreated()
 {
     $paramLeavePeriodStartDate = ParameterService::getParameter('leavePeriodStartDate');
     ParameterService::setParameter('leavePeriodStartDate', '02-01');
     ParameterService::setParameter('isLeavePeriodStartOnFeb29th', "No");
     ParameterService::setParameter('nonLeapYearLeavePeriodStartDate', "");
     $leavePeriods = TestDataService::loadObjectList('LeavePeriod', $this->fixture, 'LeavePeriod');
     $leavePeriodDao = $this->getMock('LeavePeriodDao', array('findLastLeavePeriod', 'filterByTimestamp', 'saveLeavePeriod'));
     $leavePeriodDao->expects($this->once())->method('findLastLeavePeriod')->with('2010-01-30')->will($this->returnValue($leavePeriods[1]));
     $timestamp = strtotime('+2 day', strtotime('2010-01-31'));
     $leavePeriodDao->expects($this->once())->method('filterByTimestamp')->with($timestamp)->will($this->returnValue(null));
     $leavePeriodDao->expects($this->once())->method('saveLeavePeriod')->will($this->returnValue(true));
     $this->leavePeriodService->setLeavePeriodDao($leavePeriodDao);
     $leavePeriod = $this->leavePeriodService->createNextLeavePeriod("2010-01-30");
     $this->assertTrue($leavePeriod instanceof LeavePeriod);
     $this->assertEquals($leavePeriods[2]->getStartDate(), $leavePeriod->getStartDate());
     $this->assertEquals($leavePeriods[2]->getEndDate(), $leavePeriod->getEndDate());
     ParameterService::setParameter('leavePeriodStartDate', $paramLeavePeriodStartDate);
 }
 private function _getPopulatedLeavePeriodDataHolder()
 {
     $leavePeriodDataHolder = new LeavePeriodDataHolder();
     $isLeavePeriodStartOnFeb29th = ParameterService::getParameter('isLeavePeriodStartOnFeb29th');
     $nonLeapYearLeavePeriodStartDate = ParameterService::getParameter('nonLeapYearLeavePeriodStartDate');
     $leavePeriodStartDate = ParameterService::getParameter('leavePeriodStartDate');
     $leavePeriodDataHolder->setIsLeavePeriodStartOnFeb29th($isLeavePeriodStartOnFeb29th);
     $leavePeriodDataHolder->setNonLeapYearLeavePeriodStartDate($nonLeapYearLeavePeriodStartDate);
     $leavePeriodDataHolder->setStartDate($leavePeriodStartDate);
     $leavePeriodDataHolder->setDateFormat('Y-m-d');
     return $leavePeriodDataHolder;
 }