예제 #1
0
 public function getLast()
 {
     try {
         $lastId = $this->getLastId();
         $data = $this->_persistence->retrieve($lastId);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $factory = new Factory();
     return $factory->make($data);
 }
예제 #2
0
 public function testEnviaObjectoARepositorio()
 {
     $slideData = $this->_stack[0];
     $factory = new SlideFactory();
     $slide = $factory->make($slideData);
     $repository = $this->_container->get('repository');
     $repository->add($slide);
     $slide2 = $repository->getLast();
     $this->assertNotEmpty($slide2->getId());
     $this->assertEquals($slide->getTitle(), $slide2->getTitle());
     $this->assertEquals($slide->getDescription(), $slide2->getDescription());
     $this->assertEquals($slide->getImg(), $slide2->getImg());
     $this->assertEquals($slide->getLink(), $slide2->getLink());
     $this->assertEquals($slide->getCreatedAt(), $slide2->getCreatedAt());
     $this->assertEquals($slide->getUpdatedAt(), $slide2->getUpdatedAt());
 }
예제 #3
0
 public function testSiTieneTodosLosCampos()
 {
     $title = 'Titulo del slide';
     $description = 'Descripcion del slide';
     $img = 'uploads/imgTest.png';
     $link = 'http://www.google.com.ar';
     $created = date('Y-m-d h:i:s');
     $upadted = $created;
     $slideData = array('Title' => $title, 'Description' => $description, 'Img' => $img, 'Link' => $link, 'CreatedAt' => $created, 'UpdatedAt' => $upadted);
     $factory = new SlideFactory();
     $slide = $factory->make($slideData);
     $this->assertEquals($title, $slide->getTitle());
     $this->assertEquals($description, $slide->getDescription());
     $this->assertEquals($img, $slide->getImg());
     $this->assertEquals($link, $slide->getLink());
     $this->assertEquals($created, $slide->getCreatedAt());
     $this->assertEquals($upadted, $slide->getUpdatedAt());
 }