repo = new PatientRepo(); } public function testConstruct(){ $this->assertTrue(new PatientRepo() instanceof PatientRepo); } public function testGetById(){ $this->assertEquals($this->repo->getById(2)['Nom'],'KEMP'); } public function testAddAndDeletePatient(){ $id = $this->repo->add('M','Lucas','Mascaro','3 rue des fleurs qui sentent bon',NULL,'Pimpous-Les-Bains','31524','1996-11-19','Toulouse','123456789876543', 69); $this->assertNotNull($id); $this->assertTrue($this->repo->delete($id)); } public function testSearch(){ $this->assertEquals($this->repo->search('KEMP','Clay')[0]['Nom'],'KEMP'); } public function testUpdateMedecinTraitant(){ $id = rand(0,100); $this->repo->updateMedecinTraitant(2,$id); $this->assertEquals($this->repo->getById(2)['MedecinTraitant'],$id); } public function testGetAll(){ $this->assertEquals(count($this->repo->getAll()),100); } public function testUpdate(){ $id = PatientRepo::add('M','Lucas','Mascaro','3 rue des fleurs qui sentent bon',NULL,'Pimpous-Les-Bains','31524','1996-11-19','Toulouse','123456789876543', 69); $this->assertEquals(0,PatientRepo::update($id,'F','Lucas','Mascaro','3 rue des fleurs qui sentent bon','lol','Pimpous-Les-Bains','31524','19/11/1996','Toulouse','123456789876543', 69)); $patient = PatientRepo::getById($id); $this->assertEquals('F',$patient['Civilite']); PatientRepo::delete($id); } }