Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
83.33% covered (warning)
83.33%
5 / 6
CRAP
87.50% covered (warning)
87.50%
14 / 16
PatientRepoTest
0.00% covered (danger)
0.00%
0 / 1
83.33% covered (warning)
83.33%
5 / 6
6.07
87.50% covered (warning)
87.50%
14 / 16
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 testConstruct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 testGetById
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 testAddAndDeletePatient
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
 testSearch
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 testUpdateMedecinTraitant
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
<?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);
    }
}