diff --git a/coverage/StaticRepo.php.html b/coverage/StaticRepo.php.html index 3583e25..eda9e8e 100755 --- a/coverage/StaticRepo.php.html +++ b/coverage/StaticRepo.php.html @@ -201,13 +201,13 @@
12
     * @return PDO instance de la connexion a la BDD
13
     */
14
    public static function getConnexion(){ -
15
        if(static::$config == null){ +
15
        if(static::$config == null){
16
            static::$config = json_decode(file_get_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.json'),true);
17
        } -
18
        if(static::$connexion == null){ +
18
        if(static::$connexion == null){
19
            static::$connexion = new PDO('mysql:host='.static::$config['host'].';dbname='.static::$config['database'], static::$config['login'], static::$config['password']);
20
        } -
21
        return static::$connexion; +
21
        return static::$connexion;
22
    }
23
24
    /** @@ -372,7 +372,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:01:45 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:26:02 UTC 2016.

diff --git a/coverage/dashboard.html b/coverage/dashboard.html index a064547..0459ac0 100755 --- a/coverage/dashboard.html +++ b/coverage/dashboard.html @@ -59,7 +59,6 @@ StaticRepo83% - RDVRepo88% @@ -77,7 +76,6 @@ StaticRepo66 - RDVRepo25 @@ -116,7 +114,6 @@ update0% - getForMonth0% checkParam80% delNumeric85% getAll86% @@ -150,7 +147,7 @@ @@ -171,7 +168,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,2,3,0], "Class Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,1,4,0], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -189,7 +186,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([2,0,0,0,0,0,0,0,0,4,4,19], "Method Coverage")) + .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,4,3,21], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -239,7 +236,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[83.928571428571,54,"StaticRepo<\/a>"],[91.176470588235,20,"MedecinRepo<\/a>"],[97.560975609756,47,"PatientRepo<\/a>"],[88.709677419355,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[83.928571428571,54,"StaticRepo<\/a>"],[91.176470588235,20,"MedecinRepo<\/a>"],[97.560975609756,47,"PatientRepo<\/a>"],[96.774193548387,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -263,7 +260,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[100,3,"StaticRepo::getConnexion<\/a>"],[100,1,"StaticRepo::testConnexion<\/a>"],[85.714285714286,10,"StaticRepo::delNumeric<\/a>"],[80.555555555556,40,"StaticRepo::checkParam<\/a>"],[100,2,"MedecinRepo::getById<\/a>"],[88.888888888889,5,"MedecinRepo::add<\/a>"],[100,2,"MedecinRepo::delete<\/a>"],[100,7,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[0,1,"MedecinRepo::update<\/a>"],[100,2,"PatientRepo::getById<\/a>"],[96.774193548387,16,"PatientRepo::add<\/a>"],[96.774193548387,16,"PatientRepo::update<\/a>"],[100,2,"PatientRepo::delete<\/a>"],[100,3,"PatientRepo::updateMedecinTraitant<\/a>"],[100,7,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,2,"RDVRepo::getById<\/a>"],[0,1,"RDVRepo::getForMonth<\/a>"],[100,2,"RDVRepo::getByDate<\/a>"],[100,2,"RDVRepo::delete<\/a>"],[91.666666666667,6,"RDVRepo::add<\/a>"],[100,2,"RDVRepo::updateDateTime<\/a>"],[100,3,"RDVRepo::getByPatientAndDate<\/a>"],[86.666666666667,5,"RDVRepo::getAll<\/a>"],[100,2,"RDVRepo::getByMonth<\/a>"],[92.592592592593,8,"StatsRepo::getAgePatient<\/a>"],[100,1,"StatsRepo::getRDVStat<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[100,3,"StaticRepo::getConnexion<\/a>"],[100,1,"StaticRepo::testConnexion<\/a>"],[85.714285714286,10,"StaticRepo::delNumeric<\/a>"],[80.555555555556,40,"StaticRepo::checkParam<\/a>"],[100,2,"MedecinRepo::getById<\/a>"],[88.888888888889,5,"MedecinRepo::add<\/a>"],[100,2,"MedecinRepo::delete<\/a>"],[100,7,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[0,1,"MedecinRepo::update<\/a>"],[100,2,"PatientRepo::getById<\/a>"],[96.774193548387,16,"PatientRepo::add<\/a>"],[96.774193548387,16,"PatientRepo::update<\/a>"],[100,2,"PatientRepo::delete<\/a>"],[100,3,"PatientRepo::updateMedecinTraitant<\/a>"],[100,7,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,2,"RDVRepo::getById<\/a>"],[100,1,"RDVRepo::getForMonth<\/a>"],[100,2,"RDVRepo::getByDate<\/a>"],[100,2,"RDVRepo::delete<\/a>"],[100,6,"RDVRepo::add<\/a>"],[100,2,"RDVRepo::updateDateTime<\/a>"],[100,3,"RDVRepo::getByPatientAndDate<\/a>"],[86.666666666667,5,"RDVRepo::getAll<\/a>"],[100,2,"RDVRepo::getByMonth<\/a>"],[92.592592592593,8,"StatsRepo::getAgePatient<\/a>"],[100,1,"StatsRepo::getRDVStat<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/coverage/index.html b/coverage/index.html index fdbb6bc..c7ea752 100755 --- a/coverage/index.html +++ b/coverage/index.html @@ -43,21 +43,21 @@ Total
-
- 91.32% covered (success) +
+ 93.21% covered (success)
-
91.32%
-
242 / 265
+
93.21%
+
247 / 265
-
- 65.52% covered (warning) +
+ 72.41% covered (warning)
-
65.52%
-
19 / 29
+
72.41%
+
21 / 29
0.00% covered (danger) @@ -71,21 +71,21 @@ repos
-
- 93.30% covered (success) +
+ 95.69% covered (success)
-
93.30%
-
195 / 209
+
95.69%
+
200 / 209
-
- 68.00% covered (warning) +
+ 76.00% covered (warning)
-
68.00%
-
17 / 25
+
76.00%
+
19 / 25
0.00% covered (danger) @@ -136,7 +136,7 @@ High: 90% to 100%

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:01:45 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:26:02 UTC 2016.

diff --git a/coverage/repos/MedecinRepo.php.html b/coverage/repos/MedecinRepo.php.html index 81325dc..bf4f5ff 100755 --- a/coverage/repos/MedecinRepo.php.html +++ b/coverage/repos/MedecinRepo.php.html @@ -359,7 +359,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:01:45 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:26:02 UTC 2016.

diff --git a/coverage/repos/PatientRepo.php.html b/coverage/repos/PatientRepo.php.html index 003bbd4..f501eda 100755 --- a/coverage/repos/PatientRepo.php.html +++ b/coverage/repos/PatientRepo.php.html @@ -424,7 +424,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:01:45 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:26:02 UTC 2016.

diff --git a/coverage/repos/RDVRepo.php.html b/coverage/repos/RDVRepo.php.html index c56baf4..6d44799 100755 --- a/coverage/repos/RDVRepo.php.html +++ b/coverage/repos/RDVRepo.php.html @@ -52,22 +52,22 @@
0.00%
0 / 1
-
- 66.67% covered (warning) +
+ 88.89% covered (warning)
-
66.67%
-
6 / 9
+
88.89%
+
8 / 9
CRAP -
-
- 88.71% covered (warning) +
+
+ 96.77% covered (success)
-
88.71%
-
55 / 62
+
96.77%
+
60 / 62
@@ -81,22 +81,22 @@
0.00%
0 / 1
-
- 66.67% covered (warning) +
+ 88.89% covered (warning)
-
66.67%
-
6 / 9
- 25.90 -
-
- 88.71% covered (warning) +
88.89%
+
8 / 9
+ 25 +
+
+ 96.77% covered (success)
-
88.71%
-
55 / 62
+
96.77%
+
60 / 62
@@ -121,24 +121,24 @@ -  getForMonth -
-
- 0.00% covered (danger) +  getForMonth +
+
+ 100.00% covered (success)
-
0.00%
-
0 / 1
- 2 -
-
- 0.00% covered (danger) +
100.00%
+
1 / 1
+ 1 +
+
+ 100.00% covered (success)
-
0.00%
-
0 / 4
+
100.00%
+
4 / 4
@@ -184,24 +184,24 @@ -  add -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- 6.02 +  add
-
- 91.67% covered (success) +
+ 100.00% covered (success)
-
91.67%
-
11 / 12
+
100.00%
+
1 / 1
+ 6 +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
12 / 12
@@ -315,15 +315,15 @@     }     public static function getForMonth($month, $year){ -         $req = StaticRepo::getConnexion()->prepare("SELECT RDV.Id, RDV.DateRDV, RDV.Medecin_Id, RDV.Patient_Id, RDV.Duree, Medecin.Prenom as M_Prenom, Medecin.Nom as M_Nom, Patient.Prenom as P_Prenom, Patient.Nom as P_Nom +         $req = StaticRepo::getConnexion()->prepare("SELECT RDV.Id, RDV.DateRDV, RDV.Medecin_Id, RDV.Patient_Id, RDV.Duree, Medecin.Prenom as M_Prenom, Medecin.Nom as M_Nom, Patient.Prenom as P_Prenom, Patient.Nom as P_Nom             FROM RDV, Patient, Medecin             WHERE Patient.Id = RDV.Patient_Id             AND   Medecin.Id = RDV.Medecin_Id             AND   MONTH(DateRDV) = :month             AND   YEAR(DateRDV) = :year -             ORDER BY DateRDV ASC"); -         $req->execute(array( ':month' => $month, ':year' => $year )); -         return $req->fetchAll(); +             ORDER BY DateRDV ASC"); +         $req->execute(array( ':month' => $month, ':year' => $year )); +         return $req->fetchAll();     }     public static function getByDate($date){ @@ -360,7 +360,7 @@         $id = StaticRepo::getConnexion()->lastInsertId();         settype($id,'integer');         if($result){return $id;} -         else{return false;} +         else{return false;}     }     public static function updateDateTime($idRDV, $dateRdv, $duree){ @@ -437,7 +437,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:01:45 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:26:02 UTC 2016.

diff --git a/coverage/repos/StatsRepo.php.html b/coverage/repos/StatsRepo.php.html index 923d823..0a7dd77 100755 --- a/coverage/repos/StatsRepo.php.html +++ b/coverage/repos/StatsRepo.php.html @@ -220,7 +220,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:01:45 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:26:02 UTC 2016.

diff --git a/coverage/repos/dashboard.html b/coverage/repos/dashboard.html index 57464f7..717ed5f 100755 --- a/coverage/repos/dashboard.html +++ b/coverage/repos/dashboard.html @@ -59,7 +59,6 @@ - RDVRepo88% @@ -76,7 +75,6 @@ - RDVRepo25 @@ -114,7 +112,6 @@ - getForMonth0% update0% getAll86% add88% @@ -145,7 +142,7 @@
@@ -166,7 +163,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,1,3,0], "Class Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,4,0], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -184,7 +181,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([2,0,0,0,0,0,0,0,0,2,4,17], "Method Coverage")) + .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,2,3,19], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -234,7 +231,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[91.176470588235,20,"MedecinRepo<\/a>"],[97.560975609756,47,"PatientRepo<\/a>"],[88.709677419355,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[91.176470588235,20,"MedecinRepo<\/a>"],[97.560975609756,47,"PatientRepo<\/a>"],[96.774193548387,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -258,7 +255,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[100,2,"MedecinRepo::getById<\/a>"],[88.888888888889,5,"MedecinRepo::add<\/a>"],[100,2,"MedecinRepo::delete<\/a>"],[100,7,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[0,1,"MedecinRepo::update<\/a>"],[100,2,"PatientRepo::getById<\/a>"],[96.774193548387,16,"PatientRepo::add<\/a>"],[96.774193548387,16,"PatientRepo::update<\/a>"],[100,2,"PatientRepo::delete<\/a>"],[100,3,"PatientRepo::updateMedecinTraitant<\/a>"],[100,7,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,2,"RDVRepo::getById<\/a>"],[0,1,"RDVRepo::getForMonth<\/a>"],[100,2,"RDVRepo::getByDate<\/a>"],[100,2,"RDVRepo::delete<\/a>"],[91.666666666667,6,"RDVRepo::add<\/a>"],[100,2,"RDVRepo::updateDateTime<\/a>"],[100,3,"RDVRepo::getByPatientAndDate<\/a>"],[86.666666666667,5,"RDVRepo::getAll<\/a>"],[100,2,"RDVRepo::getByMonth<\/a>"],[92.592592592593,8,"StatsRepo::getAgePatient<\/a>"],[100,1,"StatsRepo::getRDVStat<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[100,2,"MedecinRepo::getById<\/a>"],[88.888888888889,5,"MedecinRepo::add<\/a>"],[100,2,"MedecinRepo::delete<\/a>"],[100,7,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[0,1,"MedecinRepo::update<\/a>"],[100,2,"PatientRepo::getById<\/a>"],[96.774193548387,16,"PatientRepo::add<\/a>"],[96.774193548387,16,"PatientRepo::update<\/a>"],[100,2,"PatientRepo::delete<\/a>"],[100,3,"PatientRepo::updateMedecinTraitant<\/a>"],[100,7,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,2,"RDVRepo::getById<\/a>"],[100,1,"RDVRepo::getForMonth<\/a>"],[100,2,"RDVRepo::getByDate<\/a>"],[100,2,"RDVRepo::delete<\/a>"],[100,6,"RDVRepo::add<\/a>"],[100,2,"RDVRepo::updateDateTime<\/a>"],[100,3,"RDVRepo::getByPatientAndDate<\/a>"],[86.666666666667,5,"RDVRepo::getAll<\/a>"],[100,2,"RDVRepo::getByMonth<\/a>"],[92.592592592593,8,"StatsRepo::getAgePatient<\/a>"],[100,1,"StatsRepo::getRDVStat<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/coverage/repos/index.html b/coverage/repos/index.html index 99ee9a3..a040bea 100755 --- a/coverage/repos/index.html +++ b/coverage/repos/index.html @@ -44,21 +44,21 @@ Total
-
- 93.30% covered (success) +
+ 95.69% covered (success)
-
93.30%
-
195 / 209
+
95.69%
+
200 / 209
-
- 68.00% covered (warning) +
+ 76.00% covered (warning)
-
68.00%
-
17 / 25
+
76.00%
+
19 / 25
0.00% covered (danger) @@ -126,23 +126,23 @@ - RDVRepo.php -
-
- 88.71% covered (warning) + RDVRepo.php +
+
+ 96.77% covered (success)
-
88.71%
-
55 / 62
+
96.77%
+
60 / 62
-
- 66.67% covered (warning) +
+ 88.89% covered (warning)
-
66.67%
-
6 / 9
+
88.89%
+
8 / 9
0.00% covered (danger) @@ -193,7 +193,7 @@ High: 90% to 100%

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:01:45 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:26:02 UTC 2016.

diff --git a/test/RDVRepoTest.php b/test/RDVRepoTest.php index db24cdb..89ea33b 100755 --- a/test/RDVRepoTest.php +++ b/test/RDVRepoTest.php @@ -24,6 +24,9 @@ class RDVRepoTest extends PHPUnit_Framework_TestCase $this->assertNotNull($id); $this->assertNotFalse($id); $this->assertTrue($this->repo->delete($id)); + + $this->assertFalse($this->repo->add(date('Y-m-d H:i:s',time()),30,2,-1)); + } public function testGetById(){ @@ -65,4 +68,8 @@ class RDVRepoTest extends PHPUnit_Framework_TestCase $this->assertEquals(count($this->repo->getByMonth(strtotime($date))),13); } + public function testGetForMonth(){ + $this->assertEquals(count($this->repo->getForMonth('12','2015')),2); + } + }