protected function setUp()
 {
     $user = new User();
     $user->setName('Luisa');
     $user->setLastname('Pereira');
     $user->setEmail('*****@*****.**');
     $user->setPassword('123');
     $this->user = $user;
     $user1 = new User();
     $user1->setName('Andres');
     $user1->setLastname('Ramirez');
     $user1->setEmail('*****@*****.**');
     $user1->setPassword('123');
     $this->user1 = $user1;
     $startDate = strtotime("00:00pm February 21 2016");
     $project = new Project();
     $project->setName('p1');
     $project->setStartDate(date("Y-m-d h:i:sa", $startDate));
     $this->project = $project;
     $startSprintDate = strtotime("00:00pm February 25 2016");
     $expectedDate = strtotime("00:00pm March 21 2016");
     $sprint = new Sprint();
     $sprint->setProject($project);
     $sprint->setName('Sprint #1');
     $sprint->setStartDate(date("Y-m-d h:i:sa", $startSprintDate));
     $sprint->setEstimatedDate(date("Y-m-d h:i:sa", $expectedDate));
     $this->sprint = $sprint;
     $item1 = new Item();
     $item1->setSprint($sprint);
     $item1->setTitle('Tarea #1');
     $item1->setType('3');
     $item1->setDesignedUser($user);
     $item1->setEstimatedHours('4');
     $item1->setWorkedHours('6');
     $item1->setStatus('11');
     $item2 = new Item();
     $item2->setSprint($sprint);
     $item2->setTitle('Tarea #2');
     $item2->setType('3');
     $item2->setDesignedUser($user1);
     $item2->setEstimatedHours('4');
     $item2->setWorkedHours('2');
     $item2->setStatus('11');
     $item3 = new Item();
     $item3->setSprint($sprint);
     $item3->setTitle('Solicitud de Cambio #1');
     $item3->setType('6');
     $item3->setDesignedUser($user1);
     $item3->setEstimatedHours('8');
     $item3->setWorkedHours('6');
     $item3->setStatus('5');
     $item4 = new Item();
     $item4->setSprint($sprint);
     $item4->setTitle('Error #1');
     $item4->setType('4');
     $item4->setDesignedUser($user1);
     $item4->setEstimatedHours('10');
     $item4->setWorkedHours('10.5');
     $item4->setStatus('8');
     $item5 = new Item();
     $item5->setSprint($sprint);
     $item5->setTitle('Tarea #3');
     $item5->setType('3');
     $item5->setDesignedUser($user);
     $item5->setEstimatedHours('4');
     $item5->setWorkedHours('3.6');
     $item5->setStatus('5');
     $item6 = new Item();
     $item6->setSprint($sprint);
     $item6->setTitle('Error #2');
     $item6->setType('4');
     $item6->setDesignedUser($user1);
     $item6->setEstimatedHours('5');
     $item6->setWorkedHours('5');
     $item6->setStatus('7');
     $items = array($item1, $item2, $item3, $item4, $item5, $item6);
     $this->items = $items;
 }
 /**
  * Esta funcion permite cambiarle el proyecto a un elemento
  * y registrar el evento en un historial
  * @author Cesar Giraldo <*****@*****.**> 14/03/2016
  * @param Entity\Item $item
  * @param Entity\Project $previousProject
  * @param Entity\Project $newProject
  * @param Entity\Item|null $parent
  */
 private function changeProjectToItem($item, $previousProject, $newProject, $parent)
 {
     $em = $this->getDoctrine()->getManager();
     //cambiamos el Proyecto del item
     $item->setSprint(null);
     $item->setParent($parent);
     $item->setProject($newProject);
     $item->setFixedOnCycle(null);
     $em->persist($item);
     $em->flush();
     //guardamos el registro en historial
     $changes = array('before' => $previousProject . "", 'after' => $newProject . "");
     $this->container->get('app_history')->saveItemHistory($item, Entity\ItemHistory::ITEM_PROJECT_MOVED, $changes, " : " . $newProject);
 }