2015-12-08 08:31:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: seekdasky
|
|
|
|
* Date: 03/12/15
|
|
|
|
* Time: 12:50
|
|
|
|
*/
|
|
|
|
class MedecinRepoTest extends PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
private $repo;
|
|
|
|
|
|
|
|
public function __construct(){
|
|
|
|
$this->repo = new MedecinRepo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstruct(){
|
|
|
|
$this->assertTrue(new MedecinRepo() instanceof MedecinRepo);
|
|
|
|
}
|
2016-01-03 17:35:41 +00:00
|
|
|
public function testAddDeleteUpdate(){
|
2015-12-08 08:31:47 +00:00
|
|
|
$id = $this->repo->add('M','Lucas','Mascaro');
|
|
|
|
$this->assertNotNull($id);
|
2016-01-03 17:35:41 +00:00
|
|
|
$this->assertTrue($this->repo->update($id,'Mascara','Loucasse'));
|
|
|
|
$this->assertEquals($this->repo->getById($id)['Nom'],'MASCARA');
|
2015-12-08 08:31:47 +00:00
|
|
|
$this->assertTrue($this->repo->delete($id));
|
2016-01-03 17:35:41 +00:00
|
|
|
|
|
|
|
$this->assertFalse($this->repo->add('Z','Lucas','Mascaro'));
|
2015-12-08 08:31:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testSearch(){
|
|
|
|
$this->assertEquals($this->repo->search('HUFF','Heather')[0]['Nom'],'HUFF');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetPatient(){
|
|
|
|
$this->assertEquals($this->repo->getPatients(9)[0]['Nom'],'PAUL');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetById(){
|
|
|
|
|
|
|
|
$this->assertEquals($this->repo->getById(1)['Nom'],'HUFF');
|
|
|
|
}
|
|
|
|
|
2015-12-09 12:36:30 +00:00
|
|
|
public function testGetAll(){
|
|
|
|
$this->assertEquals(count($this->repo->getAll()),100);
|
|
|
|
}
|
|
|
|
|
2015-12-08 08:31:47 +00:00
|
|
|
}
|