public function test_verifica_retorno_do_update() { $data = array('id' => 1, 'nome' => 'Tarefa 1', 'descricao' => 'Descricao da tarefa', 'status' => false); $emMock = $this->getEmMock(); $emMock->expects($this->any())->method('getReference')->will($this->returnValue(new \SON\Entity\Task($data))); $class = new Task($emMock); $result = $class->update($data); $this->assertInstanceOf("\\SON\\Entity\\Task", $result); }
public function test_verifica_se_consegue_alterar_registro() { $class = new Task($this->getEm()); $data = array('nome' => 'Tarefa', 'descricao' => 'Descricao tarefa', 'status' => true); $result = $class->insert($data); $data = array('nome' => 'Tarefa alterada', 'id' => 1); $result = $class->update($data); $this->assertInstanceOf('\\SON\\Entity\\Task', $result); $obj = $this->getEm()->getRepository('SON\\Entity\\Task')->find(1); $this->assertEquals('Tarefa alterada', $obj->getNome()); }