projet-php/test/PatientRepoTest.php

47 lines
1.2 KiB
PHP
Raw Normal View History

<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 03/12/15
* Time: 12:31
*/
class PatientRepoTest extends PHPUnit_Framework_TestCase
{
private $repo;
public function __construct()
{
$this->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);
}
}