Example #1
0
 /**
  * @Given /^employee "([^"]*)" "([^"]*)" used "([^"]*)" vacation days$/
  */
 public function employeeUsedVacationDays($fname, $lname, $days)
 {
     $em = $this->get('em');
     $employee = $em->getRepository('AppBundle:Employee')->findOneBy(['firstname' => $fname, 'lastname' => $lname]);
     $vacation = new Vacation();
     $starts = $employee->getJoinedAt();
     $ends = clone $starts;
     $ends->modify('+' . $days . ' days');
     $vacation->setStartsAt($starts);
     $vacation->setEndsAt($ends);
     $vacation->setEmployee($employee);
     $employee->addVacation($vacation);
     $em->persist($employee);
     $em->flush();
 }