public function testInicializacao()
 {
     $tarefa = new Entity\Tarefa('TesteNome', 'TesteCusto', 'TestePasso');
     $this->assertEquals('TesteNome', $tarefa->getNome());
     $this->assertEquals('TesteCusto', $tarefa->getCusto());
     $this->assertEquals('TestePasso', $tarefa->getPasso());
 }
 public function testRequisito()
 {
     $tarefa = new Entity\Tarefa('TesteNomeRequisito', 100, 1);
     $requisito = new Entity\RequisitoMonetario();
     $requisito->setValor(1);
     $tarefa->addRequisito($requisito);
     $this->_em = $this->doctrineContainer->getEntityManager();
     $this->_em->persist($tarefa);
     $this->_em->flush();
     $tarefaBanco = $this->_em->getRepository('Application\\Entity\\Tarefa')->findOneByNome('TesteNomeRequisito');
     $this->assertEquals($tarefa->getNome(), $tarefaBanco->getNome());
     $this->assertEquals(1, $tarefaBanco->getRequisitos()->count());
     $this->assertInstanceOf('Application\\Entity\\RequisitoMonetario', $tarefaBanco->getRequisitos()->first());
     $this->assertEquals($tarefa->getRequisitos()->first()->getValor(), $tarefaBanco->getRequisitos()->first()->getValor());
 }
 public function testFalhaCumprirSemRequisitoEnergia()
 {
     $usuario = new Entity\Usuario();
     $usuario->setEnergia(1);
     $usuario->setSaldo(0);
     $tarefa = new Entity\Tarefa('Tarefa monetario foo', 1, 5);
     $requisito = new Entity\RequisitoMonetario();
     $requisito->setValor(1);
     $tarefa->addRequisito($requisito);
     $cumprirTarefa = new Service\CumprirTarefa($tarefa, $usuario);
     try {
         $cumprirTarefa->cumprir();
         $this->fail('Não disparou a Exception.');
     } catch (Exception $e) {
         $this->assertEquals('Saldo insuficiante.', $e->getMessage());
     }
 }
 public function addBeneficio(\Application\Entity\Beneficio $beneficio)
 {
     $this->__load();
     return parent::addBeneficio($beneficio);
 }