Example #1
0
 public function testOferta()
 {
     parent::mock();
     $this->repository->expects($this->once())->method('find')->will($this->returnValue($this->oferta));
     $this->emMod->expects($this->once())->method('getRepository')->will($this->returnValue($this->repository));
     $ofertas = $this->emMod->getRepository('BaseBundle:Ofertas')->find(0);
     $this->assertEquals(10, $ofertas->getAluBlancaIn());
     $ofertas->setAluBlancaIn(123456789);
     $ofertas->setAlurojaIn(987654321);
     $this->assertEquals(123456789, $ofertas->getAluBlancaIn());
     $this->assertEquals(987654321, $ofertas->getAlurojaIn());
 }
Example #2
0
 public function testPartida()
 {
     //mokear el repositorio para que devuelva esta partida
     parent::mock();
     $this->repository->expects($this->once())->method('find')->will($this->returnValue($this->partida));
     // mockear el  EntityManager para que devuelva el repositorio mockeado
     $this->emMod->expects($this->once())->method('getRepository')->will($this->returnValue($this->repository));
     $partidas = $this->emMod->getRepository('BaseBundle:Partida')->find(0);
     //asserts
     $this->assertEquals('test1?A', $partidas->getNombre());
     $this->assertEquals(null, $this->em->persist($partidas));
     $partidas->setNombre('test2?B');
     $this->assertEquals('test2?B', $partidas->getNombre());
     $this->assertEquals(null, $this->em->remove($partidas));
 }
 public function testUserPartida()
 {
     parent::mock();
     $player = new UserPartida($this->partida, $this->user, 40, 60, 45, 50);
     $player->setFUtilidad(2250);
     //mokear el repositorio para que devuelva esta partida
     $this->repository->expects($this->once())->method('find')->will($this->returnValue($player));
     // mockear el  EntityManager para que devuelva el repositorio mockeado
     $this->emMod->expects($this->once())->method('getRepository')->will($this->returnValue($this->repository));
     $jugador = $this->emMod->getRepository('BaseBundle:UserPartida')->find(0);
     $this->assertEquals('test1?A', $jugador->getIdPartida()->getNombre());
     $this->partida->setNombre('test2?B');
     $player->setIdPartida($this->partida);
     $player->setFUtilidad(200);
     $this->assertEquals('test2?B', $jugador->getIdPartida()->getNombre());
     $this->assertEquals(200, $jugador->getFUtilidad());
 }