From 47fe33740b6294a53a27fa6413d2536d0b11237d Mon Sep 17 00:00:00 2001 From: Lucas Mascaro Date: Sun, 3 Jan 2016 17:44:20 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Impl=C3=A9mentation=20du=20Dashboard=20(ver?= =?UTF-8?q?sion=20moche)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dashboard.php | 93 ++++++++++++++++++++++++++++++- Docs/Model.mwb.beforefix | Bin 0 -> 8949 bytes css/global.css | 54 ++++++++++++++++++ repositories/repos/StatsRepo.php | 13 ++++- 4 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 Docs/Model.mwb.beforefix diff --git a/Dashboard.php b/Dashboard.php index 72d3234..21488d7 100755 --- a/Dashboard.php +++ b/Dashboard.php @@ -21,7 +21,6 @@ if(!Authentification::checkUser(0)){ - @@ -58,7 +57,97 @@ if(!Authentification::checkUser(0)){ - +
+ + +
+

Homme

+
+
'; + } + ?> + +
+

Total

+ '.$key.'

'; + } + ?> +
+ +
+

+ '.$value.'

'; + } + ?> +
+ +
+

Femme

+
+
'; + } + ?> + +
+

Total

+ '.$key.'

'; + } + ?> +
+ +
+

+ '.$value.'

'; + } + ?> +
+ +
+ +
+ + + diff --git a/Docs/Model.mwb.beforefix b/Docs/Model.mwb.beforefix new file mode 100644 index 0000000000000000000000000000000000000000..71a36902804989fb746c39547113a69cd6bfae0f GIT binary patch literal 8949 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,'25-50'=>0,'50+'=>0]; $femme = ['25-'=>0,'25-50'=>0,'50+'=>0]; + $nbrHomme=0; + $nbrFemme=0; + foreach($patients as $key=>$patient){ $dateNaissance = strtotime($patient['DateNaissance']); $age = date('Y',time()-$dateNaissance); @@ -22,6 +25,7 @@ class StatsRepo switch($patient['Civilite']){ case 'M': + $nbrHomme++; if($patient['age']<25){ $homme['25-']++; }elseif($patient['age']<50){ @@ -31,6 +35,7 @@ class StatsRepo } break; case 'F': + $nbrFemme++; if($patient['age']<25){ $femme['25-']++; }elseif($patient['age']<50){ @@ -42,13 +47,15 @@ class StatsRepo } } - return ['H'=>$homme,'F'=>$femme]; + return ['H'=>$homme,'F'=>$femme,'NbrH'=>$nbrHomme,'NbrF'=>$nbrFemme]; } public static function getRDVStat($medecin){ - $req = StaticRepo::getConnexion()->prepare('SELECT count(*) NombreRDV FROM RDV WHERE Medecin_id = :medecin;'); + $req = StaticRepo::getConnexion()->prepare('SELECT count(*) NombreRDV, sum((HOUR(Duree)*60)+MINUTE(Duree)) AS DureeTotale FROM RDV WHERE Medecin_id = :medecin;'); $req->execute(['medecin'=>$medecin]); - return StaticRepo::delNumeric($req->fetch(),true); + $returned = StaticRepo::delNumeric($req->fetch(),true); + + return $returned; } From 093ae83dfb401c97c7f48f8266a593591ed38deb Mon Sep 17 00:00:00 2001 From: Lucas Mascaro Date: Sun, 3 Jan 2016 18:02:05 +0100 Subject: [PATCH 2/4] correction des tests unitaires --- coverage/StaticRepo.php.html | 100 ++++++----- coverage/dashboard.html | 26 +-- coverage/index.html | 42 ++--- coverage/repos/MedecinRepo.php.html | 181 +++++++++++-------- coverage/repos/PatientRepo.php.html | 104 ++++++----- coverage/repos/RDVRepo.php.html | 270 ++++++++++++++++------------ coverage/repos/StatsRepo.php.html | 117 ++++++------ coverage/repos/dashboard.html | 18 +- coverage/repos/index.html | 108 +++++------ repositories/repos/RDVRepo.php | 3 - test/RDVRepoTest.php | 14 +- test/StatsRepoTest.php | 3 +- 12 files changed, 548 insertions(+), 438 deletions(-) diff --git a/coverage/StaticRepo.php.html b/coverage/StaticRepo.php.html index fe4dac4..3583e25 100755 --- a/coverage/StaticRepo.php.html +++ b/coverage/StaticRepo.php.html @@ -60,13 +60,13 @@
2 / 4
CRAP
-
- 84.91% covered (warning) +
+ 83.93% covered (warning)
-
84.91%
-
45 / 53
+
83.93%
+
47 / 56
@@ -87,15 +87,15 @@
50.00%
2 / 4
- 49.36 + 66.10
-
- 84.91% covered (warning) +
+ 83.93% covered (warning)
-
84.91%
-
45 / 53
+
83.93%
+
47 / 56
@@ -171,15 +171,15 @@
0.00%
0 / 1
- 34.05 + 51.76
-
- 81.82% covered (warning) +
+ 80.56% covered (warning)
-
81.82%
-
27 / 33
+
80.56%
+
29 / 36
@@ -252,13 +252,13 @@         }else{             // on supprime les doublons des entrées (indice numérique) -             foreach($fetchData as $i=>$val){  // pour toutes les entrées +             foreach($fetchData as $i=>$val){ // pour toutes les entrées                                  if( !mb_detect_encoding($val, 'UTF-8') )                     $fetchData[$i] = utf8_encode($val); -                 if( is_int($i) )                    // si l'indice est un entier -                     unset( $fetchData[$i] );    // on le supprime +                 if( is_int($i) )             // si l'indice est un entier +                     unset( $fetchData[$i] ); // on le supprime             }         } @@ -309,53 +309,57 @@         switch($dbtype){             // [1] 'M' / 'F'              case 'Civilite': -                 $checker = $checker && is_string($variable) && in_array($variable, ['M','F']); +                 $checker = $checker && !is_null($variable) && is_string($variable) && in_array($variable, ['M','F']);                 break;             // [2] Chaine de caractère (longueur variable)             case 'String': -                 $checker = $checker && is_string($variable) && strlen($variable) <= $len; +                 $checker = $checker && !is_null($variable) && is_string($variable) && strlen($variable) > 0 && strlen($variable) <= $len;                 break;             case 'Integer': -                 $checker = $checker && is_int($variable) && $variable<pow(2, 32); -                 break; +                 $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 32); +                 break; -             case 'SmallInteger': -                 $checker = $checker && is_int($variable) && $variable<pow(2, 16); -                 break; +             case 'Numeric': +                 $checker = $checker && !is_null($variable) && is_numeric($variable); +                 break; -             case 'TinyInteger': -                 $checker = $checker && is_int($variable) && $variable<pow(2, 8); +             case 'SmallInteger': +                 $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 16);                 break; -             case 'BigInteger': -                 $checker = $checker && is_int($variable) && $variable<pow(2, 64); +             case 'TinyInteger': +                 $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 8);                 break; -             case 'Date': -                 $checker = $checker && is_string($variable) && ( preg_match('/\d{2}\/\d{2}\/\d{4}/', $variable) || preg_match('/\d{4}-\d{2}-\d{2}/', $variable) || preg_match('/\d{4}\/\d{2}\/\d{2}/', $variable) ); -                 break; +             case 'BigInteger': +                 $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 64); +                 break; -             case 'Heure': -                 $checker = $checker && is_string($variable) && preg_match('/(\d+):(\d+)/is',$variable); -                 break; +             case 'Date': +                 $checker = $checker && !is_null($variable) && is_string($variable) && ( preg_match('/^\d{2}\/\d{2}\/\d{4}$/', $variable) || preg_match('/^\d{4}-\d{2}-\d{2}$/', $variable) ); +                 break; -             // [N] Type inconnu -             default: $checker = false; break; -         } +             case 'Heure': +                 $checker = $checker && !is_null($variable) && is_string($variable) && preg_match('/^\d{1,2}:\d{1,2}$/', $variable); +                 break; - -         /* [3] On retourne le résultat de la vérif -         =============================================================*/ -         return $checker; +             // [N] Type inconnu +             default: $checker = false; break; +         } + -     } - - - } - - ?> +         /* [3] On retourne le résultat de la vérif +         =============================================================*/ +         return $checker; + +     } + + + } + + ?> @@ -368,7 +372,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 8:04:45 UTC 2015. + 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.

diff --git a/coverage/dashboard.html b/coverage/dashboard.html index 661824a..a064547 100755 --- a/coverage/dashboard.html +++ b/coverage/dashboard.html @@ -58,7 +58,8 @@ - StaticRepo84% + StaticRepo83% + RDVRepo88% @@ -75,7 +76,8 @@ - StaticRepo49 + StaticRepo66 + RDVRepo25 @@ -113,9 +115,11 @@ - checkParam81% + update0% + getForMonth0% + checkParam80% delNumeric85% - getAll86% + getAll86% add88% @@ -133,9 +137,9 @@ - checkParam34 + checkParam51 delNumeric10 - getAll5 + getAll5 add5 @@ -146,7 +150,7 @@
@@ -167,7 +171,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,4,0], "Class Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,2,3,0], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -185,7 +189,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,4,4,19], "Method Coverage")) + .datum(getCoverageDistributionData([2,0,0,0,0,0,0,0,0,4,4,19], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -235,7 +239,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[84.905660377358,43,"StaticRepo<\/a>"],[96.428571428571,15,"MedecinRepo<\/a>"],[97.435897435897,44,"PatientRepo<\/a>"],[94.642857142857,24,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .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')) .transition() .duration(500) .call(chart); @@ -259,7 +263,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>"],[81.818181818182,29,"StaticRepo::checkParam<\/a>"],[100,2,"MedecinRepo::getById<\/a>"],[88.888888888889,5,"MedecinRepo::add<\/a>"],[100,2,"MedecinRepo::delete<\/a>"],[100,3,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,2,"PatientRepo::getById<\/a>"],[96.774193548387,17,"PatientRepo::add<\/a>"],[96.774193548387,16,"PatientRepo::update<\/a>"],[100,2,"PatientRepo::delete<\/a>"],[100,3,"PatientRepo::updateMedecinTraitant<\/a>"],[100,3,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,2,"RDVRepo::getById<\/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>"],[91.304347826087,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>"],[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')) .transition() .duration(500) .call(chart); diff --git a/coverage/index.html b/coverage/index.html index 2f10f89..fdbb6bc 100755 --- a/coverage/index.html +++ b/coverage/index.html @@ -43,21 +43,21 @@ Total
-
- 93.36% covered (success) +
+ 91.32% covered (success)
-
93.36%
-
225 / 241
+
91.32%
+
242 / 265
-
- 70.37% covered (warning) +
+ 65.52% covered (warning)
-
70.37%
-
19 / 27
+
65.52%
+
19 / 29
0.00% covered (danger) @@ -71,21 +71,21 @@ repos
-
- 95.74% covered (success) +
+ 93.30% covered (success)
-
95.74%
-
180 / 188
+
93.30%
+
195 / 209
-
- 73.91% covered (warning) +
+ 68.00% covered (warning)
-
73.91%
-
17 / 23
+
68.00%
+
17 / 25
0.00% covered (danger) @@ -99,13 +99,13 @@ StaticRepo.php
-
- 84.91% covered (warning) +
+ 83.93% covered (warning)
-
84.91%
-
45 / 53
+
83.93%
+
47 / 56
50.00% covered (danger) @@ -136,7 +136,7 @@ High: 90% to 100%

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 8:04:45 UTC 2015. + 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.

diff --git a/coverage/repos/MedecinRepo.php.html b/coverage/repos/MedecinRepo.php.html index 794fa2e..81325dc 100755 --- a/coverage/repos/MedecinRepo.php.html +++ b/coverage/repos/MedecinRepo.php.html @@ -52,22 +52,22 @@
0.00%
0 / 1
-
- 83.33% covered (warning) +
+ 71.43% covered (warning)
-
83.33%
-
5 / 6
+
71.43%
+
5 / 7
CRAP
-
- 96.43% covered (success) +
+ 91.18% covered (success)
-
96.43%
-
27 / 28
+
91.18%
+
31 / 34
@@ -81,22 +81,22 @@
0.00%
0 / 1
-
- 83.33% covered (warning) +
+ 71.43% covered (warning)
-
83.33%
-
5 / 6
- 15 +
71.43%
+
5 / 7
+ 20.27
-
- 96.43% covered (success) +
+ 91.18% covered (success)
-
96.43%
-
27 / 28
+
91.18%
+
31 / 34
@@ -142,7 +142,7 @@ -  delete +  delete
100.00% covered (success) @@ -159,11 +159,11 @@
100.00%
-
3 / 3
+
4 / 4
-  search +  search
100.00% covered (success) @@ -172,7 +172,7 @@
100.00%
1 / 1
- 3 + 7
100.00% covered (success) @@ -180,11 +180,11 @@
100.00%
-
5 / 5
+
8 / 8
-  getPatients +  getPatients
100.00% covered (success) @@ -205,7 +205,7 @@ -  getAll +  getAll
100.00% covered (success) @@ -225,6 +225,27 @@
2 / 2
+ +  update +
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 1
+ 2 +
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 2
+ + @@ -243,7 +264,7 @@     public static function getById($id){ -         if(!StaticRepo::checkParam($id,'Integer')){return false;} +         if(!StaticRepo::checkParam($id, 'Numeric')) return false;         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Medecin WHERE Id = :id');         $req->execute(['id' => $id]); @@ -253,59 +274,79 @@     public static function add($civilite,$prenom,$nom){ -         if(!StaticRepo::checkParam($civilite,'Civilite') && !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')){return false;} +         if(!StaticRepo::checkParam($civilite,'Civilite') && !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')) return false;         $req = StaticRepo::getConnexion()->prepare('INSERT INTO Medecin VALUES (DEFAULT,:civilite,:prenom,:nom)');         $result = $req->execute(['civilite' => $civilite,             'nom' => $nom, -             'prenom' => $prenom]); -         //PDO renvoie un ID sous forme de char, on transtype -         $id = StaticRepo::getConnexion()->lastInsertId(); -         settype($id,'integer'); -         if($result){return $id;} -         else{return false;} -     } +             'prenom' => $prenom +         ]); + +         //PDO renvoie un ID sous forme de char, on transtype +         $id = StaticRepo::getConnexion()->lastInsertId(); +         settype($id, 'integer'); + -     public static function delete($idMedecin){ - -         if(!StaticRepo::checkParam($idMedecin,'Integer')){return false;} +         if($result) return $id; +         else        return false; +     } -         $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); -         return $req->execute(['id' => $idMedecin]); -     } +     public static function delete($idMedecin){ + +         if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; -     public static function search($nom,$prenom){ +         var_dump($idMedecin); -         if(!StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')){return false;} - -         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Medecin WHERE Nom LIKE :nom AND Prenom LIKE :prenom'); -         $req->execute(['nom' => $nom, -             'prenom' => $prenom]); +         $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); +         return $req->execute(['id' => $idMedecin]); +     } + +     public static function search($nom, $prenom){ -         return StaticRepo::delNumeric($req->fetchAll()); -     } - -     public static function getPatients($idMedecin){ - -         if(!StaticRepo::checkParam($idMedecin,'Integer')){return false;} - -         $req = StaticRepo::getConnexion()->prepare('SELECT Patient.* FROM Patient,Medecin -                     WHERE Medecin.Id = :id -                     AND Medecin.Id = Patient.MedecinTraitant'); - -         $req->execute(['id' => $idMedecin]); -         return StaticRepo::delNumeric($req->fetchAll()); -     } - -     public static function getAll(){ - -         $req = StaticRepo::getConnexion()->query('SELECT * FROM Medecin ORDER BY nom, prenom ASC'); - -         return StaticRepo::delNumeric( $req->fetchAll() ); - -     } - - } +         if( !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45') ) return false; + +         // on définit les valeurs (peuvent être nulles) +         $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; +         $optNom    = ( $nom    != 'null' && StaticRepo::checkParam($nom,   'String45') ) ? '%'.$nom.'%'    : '%'; + +         $req = StaticRepo::getConnexion()->query("SELECT Id, Civilite, Prenom, Nom +             FROM Medecin +             WHERE Nom LIKE '".$optNom."' +             AND Prenom LIKE '".$optPrenom."' +             ORDER BY Nom, Prenom ASC"); + + +         return StaticRepo::delNumeric( $req->fetchAll() ); +     } + +     public static function getPatients($idMedecin){ + +         if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; + +         $req = StaticRepo::getConnexion()->prepare('SELECT Patient.* FROM Patient,Medecin +                     WHERE Medecin.Id = :id +                     AND Medecin.Id = Patient.MedecinTraitant'); + +         $req->execute(['id' => $idMedecin]); +         return StaticRepo::delNumeric($req->fetchAll()); +     } + +     public static function getAll(){ + +         $req = StaticRepo::getConnexion()->query('SELECT * FROM Medecin ORDER BY nom, prenom ASC'); + +         return StaticRepo::delNumeric( $req->fetchAll() ); + +     } + + +     public static function update($id, $nom, $prenom){ + +         $req = StaticRepo::getConnexion()->prepare("UPDATE Medecin SET Nom = :nom, Prenom = :prenom WHERE Id = :id"); +         return $req->execute([ ':nom' => strtoupper($nom), ':prenom' => $prenom, ':id' => $id ]); +     } + + } @@ -318,7 +359,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 8:04:45 UTC 2015. + 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.

diff --git a/coverage/repos/PatientRepo.php.html b/coverage/repos/PatientRepo.php.html index a39d9ff..003bbd4 100755 --- a/coverage/repos/PatientRepo.php.html +++ b/coverage/repos/PatientRepo.php.html @@ -61,13 +61,13 @@
5 / 7
CRAP
-
- 97.44% covered (success) +
+ 97.56% covered (success)
-
97.44%
-
76 / 78
+
97.56%
+
80 / 82
@@ -88,15 +88,15 @@
71.43%
5 / 7
- 44 + 47
-
- 97.44% covered (success) +
+ 97.56% covered (success)
-
97.44%
-
76 / 78
+
97.56%
+
80 / 82
@@ -130,7 +130,7 @@
0.00%
0 / 1
- 17 + 16
96.77% covered (success) @@ -184,7 +184,7 @@ -  updateMedecinTraitant +  updateMedecinTraitant
100.00% covered (success) @@ -205,7 +205,7 @@ -  search +  search
100.00% covered (success) @@ -214,7 +214,7 @@
100.00%
1 / 1
- 3 + 7
100.00% covered (success) @@ -222,11 +222,11 @@
100.00%
-
4 / 4
+
8 / 8
-  getAll +  getAll
100.00% covered (success) @@ -281,11 +281,11 @@         $correctTypes = $correctTypes && StaticRepo::checkParam($codePostal,'String');         $correctTypes = $correctTypes && StaticRepo::checkParam($dateNaissance,'Date');         $correctTypes = $correctTypes && StaticRepo::checkParam($lieuNaissance,'String50'); -         $correctTypes = $correctTypes && ( $medecinTraitant == 'null' || $medecinTraitant === null ||StaticRepo::checkParam($medecinTraitant, 'Integer') ); +         $correctTypes = $correctTypes && ( $medecinTraitant == 'null' || StaticRepo::checkParam($medecinTraitant, 'Numeric'));         if( !$correctTypes ) return false;         $dateNaissance = strtotime($dateNaissance); -         $dateNaissance = Date('o-m-d',$dateNaissance); +         $dateNaissance = Date('o-m-d', $dateNaissance);         $req = StaticRepo::getConnexion()->prepare("INSERT INTO Patient             VALUES(DEFAULT, @@ -365,41 +365,53 @@     public static function delete($idPatient){ -         if(!StaticRepo::checkParam($idPatient,'Integer')){ return false;} - -         $req = StaticRepo::getConnexion()->prepare('DELETE FROM Patient WHERE Patient.Id = :id'); -         return $req->execute(['id' => $idPatient]); +         // si format erroné, retourne FALSE +         if( !StaticRepo::checkParam($idPatient, 'Numeric') ) return false; + +         $req = StaticRepo::getConnexion()->prepare('DELETE FROM Patient WHERE Patient.Id = :id'); -     } +         return $req->execute([':id' => $idPatient]); -     public static function updateMedecinTraitant($idPatient,$idMedecin){ +     } -         if(!StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($idMedecin,'Integer')){return false;} +     public static function updateMedecinTraitant($idPatient,$idMedecin){ -         $req = StaticRepo::getConnexion()->prepare('UPDATE Patient SET MedecinTraitant = :medecin WHERE Id = :id'); -         return $req->execute(['medecin' => $idMedecin, 'id' => $idPatient]); - -     } +         if(!StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($idMedecin,'Integer')){return false;} + +         $req = StaticRepo::getConnexion()->prepare('UPDATE Patient SET MedecinTraitant = :medecin WHERE Id = :id'); +         return $req->execute(['medecin' => $idMedecin, 'id' => $idPatient]); -     public static function search($nom,$prenom){ +     } -         if(!StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')){return false;} - -         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Patient WHERE Nom LIKE :nom AND Prenom LIKE :prenom'); -         $req->execute(['nom' => $nom, 'prenom' => $prenom]); -         return StaticRepo::delNumeric($req->fetchAll()); - -     } - -     public static function getAll(){ - -         $req = StaticRepo::getConnexion()->query('SELECT * FROM Patient ORDER BY nom, prenom ASC'); - -         return StaticRepo::delNumeric( $req->fetchAll() ); - -     } + +     public static function search($nom, $prenom){ + +         if( !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45') ) return false; + +         // on définit les valeurs (peuvent être nulles) +         $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; +         $optNom    = ( $nom    != 'null' && StaticRepo::checkParam($nom,   'String45') ) ? '%'.$nom.'%'    : '%'; + +         $req = StaticRepo::getConnexion()->query("SELECT Id, Civilite, Nom, Prenom, DATE_FORMAT(DateNaissance, '%d/%m/%Y') as DateNaissance, NumSecuriteSociale +             FROM Patient +             WHERE Nom LIKE '".$optNom."' +             AND Prenom LIKE '".$optPrenom."' +             ORDER BY Nom, Prenom ASC"); + - } +         return StaticRepo::delNumeric( $req->fetchAll() ); +     } + + +     public static function getAll(){ + +         $req = StaticRepo::getConnexion()->query('SELECT * FROM Patient ORDER BY nom, prenom ASC'); + +         return StaticRepo::delNumeric( $req->fetchAll() ); + +     } + + } @@ -412,7 +424,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 8:04:45 UTC 2015. + 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.

diff --git a/coverage/repos/RDVRepo.php.html b/coverage/repos/RDVRepo.php.html index 77df5ec..c56baf4 100755 --- a/coverage/repos/RDVRepo.php.html +++ b/coverage/repos/RDVRepo.php.html @@ -52,22 +52,22 @@
0.00%
0 / 1
-
- 75.00% covered (warning) +
+ 66.67% covered (warning)
-
75.00%
-
6 / 8
+
66.67%
+
6 / 9
CRAP -
-
- 94.64% covered (success) +
+
+ 88.71% covered (warning)
-
94.64%
-
53 / 56
+
88.71%
+
55 / 62
@@ -81,22 +81,22 @@
0.00%
0 / 1
-
- 75.00% covered (warning) +
+ 66.67% covered (warning)
-
75.00%
-
6 / 8
- 24.09 -
-
- 94.64% covered (success) +
66.67%
+
6 / 9
+ 25.90 +
+
+ 88.71% covered (warning)
-
94.64%
-
53 / 56
+
88.71%
+
55 / 62
@@ -121,7 +121,28 @@ -  getByDate +  getForMonth +
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 1
+ 2 +
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 4
+ + + +  getByDate
100.00% covered (success) @@ -142,7 +163,7 @@ -  delete +  delete
100.00% covered (success) @@ -163,7 +184,7 @@ -  add +  add
0.00% covered (danger) @@ -184,7 +205,7 @@ -  updateDateTime +  updateDateTime
100.00% covered (success) @@ -201,11 +222,11 @@
100.00%
-
5 / 5
+
6 / 6
-  getByPatientAndDate +  getByPatientAndDate
100.00% covered (success) @@ -226,7 +247,7 @@ -  getAll +  getAll
0.00% covered (danger) @@ -247,7 +268,7 @@ -  getByMonth +  getByMonth
100.00% covered (success) @@ -264,7 +285,7 @@
100.00%
-
6 / 6
+
7 / 7
@@ -293,98 +314,117 @@     } -     public static function getByDate($date){ - -         if(!StaticRepo::checkParam($date,'Date')){return false;} - -         $date = date('Y-m-d',strtotime($date)); -         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) = :date ORDER BY DateRDV ASC'); -         $req->execute(['date' => $date]); -         return StaticRepo::delNumeric($req->fetchAll()); -     } - -     public static function delete($idRDV){ +     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 +             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(); +     } -         if(!StaticRepo::checkParam($idRDV,'Integer')){return false;} +     public static function getByDate($date){ -         $req = StaticRepo::getConnexion()->prepare('DELETE FROM RDV WHERE RDV.id = :id'); -         return $req->execute(['id' => $idRDV]); -     } - -     public static function add($date,$duree,$idPatient,$idMedecin){ - -         if(!StaticRepo::checkParam($date,'Date') && !StaticRepo::checkParam($duree,'Integer') && !StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($idMedecin,'Integer')){return false;} +         if(!StaticRepo::checkParam($date,'Date')){return false;} + +         $date = date('Y-m-d',strtotime($date)); +         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) = :date ORDER BY DateRDV ASC'); +         $req->execute(['date' => $date]); +         return StaticRepo::delNumeric($req->fetchAll()); +     } -         $date = date('Y-m-d H:i:s',strtotime($date)); -         $duree = date('H:i:s',$duree*60); -         $req = StaticRepo::getConnexion()->prepare('INSERT INTO RDV VALUES (DEFAULT,:date,:duree,:patient,:medecin)'); -         $result = $req->execute(['date' => $date, -             'duree' => $duree, -             'patient' => $idPatient, -             'medecin' => $idMedecin]); +     public static function delete($idRDV){ + +         if(!StaticRepo::checkParam($idRDV,'Numeric')){return false;} + +         $req = StaticRepo::getConnexion()->prepare('DELETE FROM RDV WHERE RDV.id = :id'); +         return $req->execute(['id' => $idRDV]); +     } -         //PDO renvoie un ID sous forme de char, on transtype -         $id = StaticRepo::getConnexion()->lastInsertId(); -         settype($id,'integer'); -         if($result){return $id;} -         else{return false;} -     } - -     public static function updateDateTime($idRDV,$dateTime){ - -         if(!StaticRepo::checkParam($idRDV,'Integer')){return false;} - -         $date = date('Y-m-d H:i:s',strtotime($dateTime)); -         $req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date WHERE id = :id'); -         return $req->execute(['date' => $date, -             'id' => $idRDV]); -     } - -     public static function getByPatientAndDate($idPatient,$date){ +     public static function add($date,$duree,$idPatient,$idMedecin){ + +         if(!StaticRepo::checkParam($date,'Date') && !StaticRepo::checkParam($duree,'Integer') && !StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($idMedecin,'Integer')){return false;} + +         $date = date('Y-m-d H:i:s',strtotime($date)); +         $duree = date('H:i:s',$duree*60); +         $req = StaticRepo::getConnexion()->prepare('INSERT INTO RDV VALUES (DEFAULT,:date,:duree,:patient,:medecin)'); +         $result = $req->execute(['date' => $date, +             'duree' => $duree, +             'patient' => $idPatient, +             'medecin' => $idMedecin]); + +         //PDO renvoie un ID sous forme de char, on transtype +         $id = StaticRepo::getConnexion()->lastInsertId(); +         settype($id,'integer'); +         if($result){return $id;} +         else{return false;} +     } -         if(!StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($date,'Date')){return false;} +     public static function updateDateTime($idRDV, $dateRdv, $duree){ -         $date = date('Y-m-d',strtotime($date)); -         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE Patient_Id=:patient AND DATE(DateRDV)=:date'); -         $req->execute(['patient' => $idPatient, -             'date' => $date]); -         return StaticRepo::delNumeric($req->fetchAll()); -     } - -     public static function getAll($date = 0){ - -         if(!StaticRepo::checkParam($date,'Integer')){return false;} - -         $dateTime = date('Y-m-d',time()); -         switch($date){ -             case -1: -                 $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) <= :date ORDER BY DateRDV ASC'); -                 $req->execute(['date' => $dateTime]); -                 break; -             case 0: -                 $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV ORDER BY DateRDV ASC'); -                 $req->execute(); -                 break; -             case 1: -                 $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) >= :date ORDER BY DateRDV ASC'); -                 $req->execute(['date' => $dateTime]); -                 break; -         } -         return StaticRepo::delNumeric($req->fetchAll()); -     } - -     public static function getByMonth($date){ - -         if(!StaticRepo::checkParam($date,'Date')){return false;} - -         $date = date('Y-m-d',strtotime($date)); -         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE MONTH(DateRDV) = :month AND YEAR(DateRDV) = :year ORDER BY DateRDV ASC'); -         $req->execute(['month' => date('m',strtotime($date)), -                         'year' => date('Y',strtotime($date))]); -         return StaticRepo::delNumeric($req->fetchAll()); -     } - - } +         if(!StaticRepo::checkParam($idRDV, 'Numeric')) return false; + +         $req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date_rdv, Duree = :duree WHERE id = :id'); +         return $req->execute([ +             ':date_rdv' => $dateRdv, +             ':duree' => $duree, +             ':id' => $idRDV +         ]); +     } + +     public static function getByPatientAndDate($idPatient,$date){ + +         if(!StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($date,'Date')){return false;} + +         $date = date('Y-m-d',strtotime($date)); +         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE Patient_Id=:patient AND DATE(DateRDV)=:date'); +         $req->execute(['patient' => $idPatient, +             'date' => $date]); +         return StaticRepo::delNumeric($req->fetchAll()); +     } + +     public static function getAll($date = 0){ + +         if(!StaticRepo::checkParam($date,'Integer')){return false;} + +         $dateTime = date('Y-m-d',time()); +         switch($date){ +             case -1: +                 $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) <= :date ORDER BY DateRDV ASC'); +                 $req->execute(['date' => $dateTime]); +                 break; +             case 0: +                 $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV ORDER BY DateRDV ASC'); +                 $req->execute(); +                 break; +             case 1: +                 $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) >= :date ORDER BY DateRDV ASC'); +                 $req->execute(['date' => $dateTime]); +                 break; +         } +         return StaticRepo::delNumeric($req->fetchAll()); +     } + +     public static function getByMonth($date){ + +         $strDate = date( 'Y-m-d', $date ); + +         // si erreur on retourne un tableau vide +         if( !StaticRepo::checkParam($strDate, 'Date') ) return []; + +         $req = StaticRepo::getConnexion()->prepare('SELECT *, ((HOUR(Duree)*60)+MINUTE(Duree)) AS Minute FROM RDV WHERE MONTH(DateRDV) = :month AND YEAR(DateRDV) = :year ORDER BY DateRDV ASC'); +         $req->execute([ +             'month' => date( 'm', $date ), +             'year'  => date( 'Y', $date ) +         ]); + +         return StaticRepo::delNumeric( $req->fetchAll() ); +     } + + } @@ -397,7 +437,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 8:04:45 UTC 2015. + 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.

diff --git a/coverage/repos/StatsRepo.php.html b/coverage/repos/StatsRepo.php.html index a221471..923d823 100755 --- a/coverage/repos/StatsRepo.php.html +++ b/coverage/repos/StatsRepo.php.html @@ -61,13 +61,13 @@
1 / 2
CRAP
-
- 92.31% covered (success) +
+ 93.55% covered (success)
-
92.31%
-
24 / 26
+
93.55%
+
29 / 31
@@ -88,15 +88,15 @@
50.00%
1 / 2
- 9.04 + 9.02
-
- 92.31% covered (success) +
+ 93.55% covered (success)
-
92.31%
-
24 / 26
+
93.55%
+
29 / 31
@@ -109,19 +109,19 @@
0.00%
0 / 1
- 8.04 + 8.03
-
- 91.30% covered (success) +
+ 92.59% covered (success)
-
91.30%
-
21 / 23
+
92.59%
+
25 / 27
-  getRDVStat +  getRDVStat
100.00% covered (success) @@ -138,7 +138,7 @@
100.00%
-
3 / 3
+
4 / 4
@@ -163,44 +163,51 @@         $homme = ['25-'=>0,'25-50'=>0,'50+'=>0];         $femme = ['25-'=>0,'25-50'=>0,'50+'=>0]; -         foreach($patients as $key=>$patient){ -             $dateNaissance = strtotime($patient['DateNaissance']); -             $age = date('Y',time()-$dateNaissance); -             $patient['age'] = $age - 1970; - -             switch($patient['Civilite']){ -                 case 'M': -                     if($patient['age']<25){ -                         $homme['25-']++; -                     }elseif($patient['age']<50){ -                         $homme['25-50']++; -                     }else{ -                         $homme['50+']++; -                     } -                     break; -                 case 'F': -                     if($patient['age']<25){ -                         $femme['25-']++; -                     }elseif($patient['age']<50){ -                         $femme['25-50']++; -                     }else{ -                         $femme['50+']++; -                     } -                     break; -             } -         } - -         return ['H'=>$homme,'F'=>$femme]; -     } - -     public static function getRDVStat($medecin){ -         $req = StaticRepo::getConnexion()->prepare('SELECT count(*) NombreRDV FROM RDV WHERE Medecin_id = :medecin;'); -         $req->execute(['medecin'=>$medecin]); -         return StaticRepo::delNumeric($req->fetch(),true); -     } - - - } +         $nbrHomme=0; +         $nbrFemme=0; + +         foreach($patients as $key=>$patient){ +             $dateNaissance = strtotime($patient['DateNaissance']); +             $age = date('Y',time()-$dateNaissance); +             $patient['age'] = $age - 1970; + +             switch($patient['Civilite']){ +                 case 'M': +                     $nbrHomme++; +                     if($patient['age']<25){ +                         $homme['25-']++; +                     }elseif($patient['age']<50){ +                         $homme['25-50']++; +                     }else{ +                         $homme['50+']++; +                     } +                     break; +                 case 'F': +                     $nbrFemme++; +                     if($patient['age']<25){ +                         $femme['25-']++; +                     }elseif($patient['age']<50){ +                         $femme['25-50']++; +                     }else{ +                         $femme['50+']++; +                     } +                     break; +             } +         } + +         return ['H'=>$homme,'F'=>$femme,'NbrH'=>$nbrHomme,'NbrF'=>$nbrFemme]; +     } + +     public static function getRDVStat($medecin){ +         $req = StaticRepo::getConnexion()->prepare('SELECT count(*) NombreRDV, sum((HOUR(Duree)*60)+MINUTE(Duree)) AS DureeTotale FROM RDV WHERE Medecin_id = :medecin;'); +         $req->execute(['medecin'=>$medecin]); +         $returned = StaticRepo::delNumeric($req->fetch(),true); + +         return $returned; +     } + + + } @@ -213,7 +220,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 8:04:45 UTC 2015. + 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.

diff --git a/coverage/repos/dashboard.html b/coverage/repos/dashboard.html index a8142b7..57464f7 100755 --- a/coverage/repos/dashboard.html +++ b/coverage/repos/dashboard.html @@ -59,6 +59,7 @@ + RDVRepo88% @@ -75,6 +76,7 @@ + RDVRepo25 @@ -112,7 +114,9 @@ - getAll86% + getForMonth0% + update0% + getAll86% add88% @@ -130,7 +134,7 @@ - getAll5 + getAll5 add5 @@ -141,7 +145,7 @@
@@ -162,7 +166,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,4,0], "Class Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,1,3,0], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -180,7 +184,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,2,4,17], "Method Coverage")) + .datum(getCoverageDistributionData([2,0,0,0,0,0,0,0,0,2,4,17], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -230,7 +234,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[96.428571428571,15,"MedecinRepo<\/a>"],[97.435897435897,44,"PatientRepo<\/a>"],[94.642857142857,24,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[91.176470588235,20,"MedecinRepo<\/a>"],[97.560975609756,47,"PatientRepo<\/a>"],[88.709677419355,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -254,7 +258,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,3,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,2,"PatientRepo::getById<\/a>"],[96.774193548387,17,"PatientRepo::add<\/a>"],[96.774193548387,16,"PatientRepo::update<\/a>"],[100,2,"PatientRepo::delete<\/a>"],[100,3,"PatientRepo::updateMedecinTraitant<\/a>"],[100,3,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,2,"RDVRepo::getById<\/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>"],[91.304347826087,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>"],[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')) .transition() .duration(500) .call(chart); diff --git a/coverage/repos/index.html b/coverage/repos/index.html index d575f2a..99ee9a3 100755 --- a/coverage/repos/index.html +++ b/coverage/repos/index.html @@ -44,21 +44,21 @@ Total
-
- 95.74% covered (success) +
+ 93.30% covered (success)
-
95.74%
-
180 / 188
+
93.30%
+
195 / 209
-
- 73.91% covered (warning) +
+ 68.00% covered (warning)
-
73.91%
-
17 / 23
+
68.00%
+
17 / 25
0.00% covered (danger) @@ -72,41 +72,13 @@ MedecinRepo.php
-
- 96.43% covered (success) +
+ 91.18% covered (success)
-
96.43%
-
27 / 28
-
-
- 83.33% covered (warning) -
-
- -
83.33%
-
5 / 6
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- - - - PatientRepo.php -
-
- 97.44% covered (success) -
-
- -
97.44%
-
76 / 78
+
91.18%
+
31 / 34
71.43% covered (warning) @@ -126,23 +98,51 @@ - RDVRepo.php + PatientRepo.php
-
- 94.64% covered (success) +
+ 97.56% covered (success)
-
94.64%
-
53 / 56
+
97.56%
+
80 / 82
-
- 75.00% covered (warning) +
+ 71.43% covered (warning)
-
75.00%
-
6 / 8
+
71.43%
+
5 / 7
+
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 1
+ + + + RDVRepo.php +
+
+ 88.71% covered (warning) +
+
+ +
88.71%
+
55 / 62
+
+
+ 66.67% covered (warning) +
+
+ +
66.67%
+
6 / 9
0.00% covered (danger) @@ -156,13 +156,13 @@ StatsRepo.php
-
- 92.31% covered (success) +
+ 93.55% covered (success)
-
92.31%
-
24 / 26
+
93.55%
+
29 / 31
50.00% covered (danger) @@ -193,7 +193,7 @@ High: 90% to 100%

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.3 at Thu Dec 17 8:04:45 UTC 2015. + 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.

diff --git a/repositories/repos/RDVRepo.php b/repositories/repos/RDVRepo.php index 617e81d..3db4ca5 100755 --- a/repositories/repos/RDVRepo.php +++ b/repositories/repos/RDVRepo.php @@ -72,9 +72,6 @@ class RDVRepo if(!StaticRepo::checkParam($idRDV, 'Numeric')) return false; - var_dump($idRDV); - var_dump($dateRdv); - var_dump($duree); $req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date_rdv, Duree = :duree WHERE id = :id'); return $req->execute([ ':date_rdv' => $dateRdv, diff --git a/test/RDVRepoTest.php b/test/RDVRepoTest.php index aca1c52..db24cdb 100755 --- a/test/RDVRepoTest.php +++ b/test/RDVRepoTest.php @@ -33,36 +33,36 @@ class RDVRepoTest extends PHPUnit_Framework_TestCase public function testUpdateTime(){ $date = date('Y-m-d H:i:s',time()); - $this->assertTrue($this->repo->updateDateTime(1,$date)); + $this->assertTrue($this->repo->updateDateTime(1,$date,'00:30:00')); $result = $this->repo->getById(1); $this->assertEquals($date,$result['DateRDV']); } public function testGetByDate(){ $date = date('Y-m-d H:i:s',time()); - $this->assertTrue($this->repo->updateDateTime(1,$date)); - $result = $this->repo->getByDate($date = date('Y/m/d',strtotime($date))); + $this->assertTrue($this->repo->updateDateTime(1,$date,'00:30:00')); + $result = $this->repo->getByDate(date('Y-m-d',strtotime($date))); $this->assertTrue(isset($result[0])); $this->assertEquals($result[0]['Id'],1); } public function testGetByPAtientAndDate(){ $date = '2015-12-20 13:33:00'; - $this->assertTrue($this->repo->updateDateTime(1,$date)); + $this->assertTrue($this->repo->updateDateTime(1,$date,'00:30:00')); $result = $this->repo->getByPatientAndDate(14,date('Y-m-d',strtotime($date))); $this->assertTrue(isset($result[0])); $this->assertEquals($result[0]['Id'],1); } public function testGetAll(){ - $this->assertEquals(count($this->repo->getAll(-1)),99); + $this->assertEquals(count($this->repo->getAll(-1)),100); $this->assertEquals(count($this->repo->getAll(0)),100); - $this->assertEquals(count($this->repo->getAll(1)),1); + $this->assertEquals(count($this->repo->getAll(1)),0); } public function testGetByMonth(){ $date = '2015-12-00 00:00:00'; - $this->assertEquals(count($this->repo->getByMonth(date('Y-m-d',strtotime($date)))),13); + $this->assertEquals(count($this->repo->getByMonth(strtotime($date))),13); } } diff --git a/test/StatsRepoTest.php b/test/StatsRepoTest.php index 4b1a135..84d6de5 100755 --- a/test/StatsRepoTest.php +++ b/test/StatsRepoTest.php @@ -9,13 +9,14 @@ class StatsRepoTest extends PHPUnit_Framework_TestCase { public function testAgePatient(){ - $array=['H'=>['25-'=>31,'25-50'=>2,'50+'=>16],'F'=>['25-'=>36,'25-50'=>6,'50+'=>9]]; + $array=['H'=>['25-'=>31,'25-50'=>2,'50+'=>16],'F'=>['25-'=>36,'25-50'=>6,'50+'=>9],'NbrH'=>49,'NbrF'=>51]; $this->assertEquals(StatsRepo::getAgePatient(),$array); } public function testRDVStat(){ $this->assertEquals(StatsRepo::getRDVStat(2)['NombreRDV'],2); + $this->assertEquals(StatsRepo::getRDVStat(2)['DureeTotale'],120); } } From 82cd76a11cdb40eeca5a72cbd346914b33e89f61 Mon Sep 17 00:00:00 2001 From: Lucas Mascaro Date: Sun, 3 Jan 2016 18:26:34 +0100 Subject: [PATCH 3/4] completion des tests unitaires --- coverage/StaticRepo.php.html | 8 +-- coverage/dashboard.html | 13 ++-- coverage/index.html | 34 +++++----- coverage/repos/MedecinRepo.php.html | 2 +- coverage/repos/PatientRepo.php.html | 2 +- coverage/repos/RDVRepo.php.html | 102 ++++++++++++++-------------- coverage/repos/StatsRepo.php.html | 2 +- coverage/repos/dashboard.html | 13 ++-- coverage/repos/index.html | 38 +++++------ test/RDVRepoTest.php | 7 ++ 10 files changed, 111 insertions(+), 110 deletions(-) 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 @@      * @return PDO instance de la connexion a la BDD      */     public static function getConnexion(){ -         if(static::$config == null){ +         if(static::$config == null){             static::$config = json_decode(file_get_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.json'),true);         } -         if(static::$connexion == null){ +         if(static::$connexion == null){             static::$connexion = new PDO('mysql:host='.static::$config['host'].';dbname='.static::$config['database'], static::$config['login'], static::$config['password']);         } -         return static::$connexion; +         return static::$connexion;     }     /** @@ -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); + } + } From cd1daeb05127646b6c811a81c13016d673c85295 Mon Sep 17 00:00:00 2001 From: Lucas Mascaro Date: Sun, 3 Jan 2016 18:35:41 +0100 Subject: [PATCH 4/4] correction et completion de tests --- coverage/StaticRepo.php.html | 56 +++++++-------- coverage/dashboard.html | 11 ++- coverage/index.html | 34 +++++----- coverage/repos/MedecinRepo.php.html | 102 ++++++++++++++-------------- coverage/repos/PatientRepo.php.html | 8 +-- coverage/repos/RDVRepo.php.html | 2 +- coverage/repos/StatsRepo.php.html | 2 +- coverage/repos/dashboard.html | 11 ++- coverage/repos/index.html | 34 +++++----- repositories/repos/MedecinRepo.php | 4 +- repositories/repos/PatientRepo.php | 2 +- test/MedecinRepoTest.php | 6 +- 12 files changed, 137 insertions(+), 135 deletions(-) diff --git a/coverage/StaticRepo.php.html b/coverage/StaticRepo.php.html index eda9e8e..7062b70 100755 --- a/coverage/StaticRepo.php.html +++ b/coverage/StaticRepo.php.html @@ -201,13 +201,13 @@      * @return PDO instance de la connexion a la BDD      */     public static function getConnexion(){ -         if(static::$config == null){ -             static::$config = json_decode(file_get_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.json'),true); +         if(static::$config == null){ +             static::$config = json_decode(file_get_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.json'),true);         } -         if(static::$connexion == null){ -             static::$connexion = new PDO('mysql:host='.static::$config['host'].';dbname='.static::$config['database'], static::$config['login'], static::$config['password']); +         if(static::$connexion == null){ +             static::$connexion = new PDO('mysql:host='.static::$config['host'].';dbname='.static::$config['database'], static::$config['login'], static::$config['password']);         } -         return static::$connexion; +         return static::$connexion;     }     /** @@ -230,11 +230,11 @@     public static function delNumeric($fetchData, $oneDimension=false){          // cas où fetch renvoie FALSE -     if( $fetchData === false ) return false; +     if( $fetchData === false ) return false;         /* [1] 2 dimensions         ===============================================*/ -         if( !$oneDimension ){ +         if( !$oneDimension ){         // on supprime les doublons des entrées (indice numérique)         for( $i = 0 ; $i < count($fetchData) ; $i++ ) // pour tout les utilisateurs @@ -252,18 +252,18 @@         }else{             // on supprime les doublons des entrées (indice numérique) -             foreach($fetchData as $i=>$val){ // pour toutes les entrées +             foreach($fetchData as $i=>$val){ // pour toutes les entrées                  -                 if( !mb_detect_encoding($val, 'UTF-8') ) +                 if( !mb_detect_encoding($val, 'UTF-8') )                     $fetchData[$i] = utf8_encode($val); -                 if( is_int($i) )             // si l'indice est un entier -                     unset( $fetchData[$i] ); // on le supprime +                 if( is_int($i) )             // si l'indice est un entier +                     unset( $fetchData[$i] ); // on le supprime             }         } -         return $fetchData; +         return $fetchData;     } @@ -291,39 +291,39 @@     public static function checkParam($variable, $dbtype){         /* [1] on vérifie que $dbtype est un String         =============================================================*/ -         if( !is_string($dbtype) ) return false; +         if( !is_string($dbtype) ) return false;         /* [2] Vérifications         =============================================================*/ -         $checker = true; // contiendra VRAI si la vérification s'avère correcte -         $matches = []; -         $len = 8; +         $checker = true; // contiendra VRAI si la vérification s'avère correcte +         $matches = []; +         $len = 8;         //si on a un type scalairexlongueur, on traite -         if(preg_match_all('/([A-Z][a-z]+)(\d+)/s', $dbtype,$matches)){ -             $dbtype = $matches[1][0]; -             $len    = $matches[2][0]; +         if(preg_match_all('/([A-Z][a-z]+)(\d+)/s', $dbtype,$matches)){ +             $dbtype = $matches[1][0]; +             $len    = $matches[2][0];         }         switch($dbtype){             // [1] 'M' / 'F'  -             case 'Civilite': -                 $checker = $checker && !is_null($variable) && is_string($variable) && in_array($variable, ['M','F']); -                 break; +             case 'Civilite': +                 $checker = $checker && !is_null($variable) && is_string($variable) && in_array($variable, ['M','F']); +                 break;             // [2] Chaine de caractère (longueur variable)             case 'String': -                 $checker = $checker && !is_null($variable) && is_string($variable) && strlen($variable) > 0 && strlen($variable) <= $len; -                 break; +                 $checker = $checker && !is_null($variable) && is_string($variable) && strlen($variable) > 0 && strlen($variable) <= $len; +                 break;             case 'Integer':                 $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 32);                 break;             case 'Numeric': -                 $checker = $checker && !is_null($variable) && is_numeric($variable); -                 break; +                 $checker = $checker && !is_null($variable) && is_numeric($variable); +                 break;             case 'SmallInteger':                 $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 16); @@ -352,7 +352,7 @@         /* [3] On retourne le résultat de la vérif         =============================================================*/ -         return $checker; +         return $checker;     } @@ -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:26:02 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:34:44 UTC 2016.

diff --git a/coverage/dashboard.html b/coverage/dashboard.html index 0459ac0..f680577 100755 --- a/coverage/dashboard.html +++ b/coverage/dashboard.html @@ -113,7 +113,6 @@ - update0% checkParam80% delNumeric85% getAll86% @@ -137,7 +136,7 @@ checkParam51 delNumeric10 getAll5 - add5 + add3 @@ -147,7 +146,7 @@
@@ -186,7 +185,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,4,3,21], "Method Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,4,3,22], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -236,7 +235,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>"],[96.774193548387,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[83.928571428571,54,"StaticRepo<\/a>"],[97.058823529412,17,"MedecinRepo<\/a>"],[97.560975609756,46,"PatientRepo<\/a>"],[96.774193548387,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -260,7 +259,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>"],[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')) + .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,3,"MedecinRepo::add<\/a>"],[100,2,"MedecinRepo::delete<\/a>"],[100,6,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,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,6,"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 c7ea752..0006479 100755 --- a/coverage/index.html +++ b/coverage/index.html @@ -43,21 +43,21 @@ Total
-
- 93.21% covered (success) +
+ 93.96% covered (success)
-
93.21%
-
247 / 265
+
93.96%
+
249 / 265
-
- 72.41% covered (warning) +
+ 75.86% covered (warning)
-
72.41%
-
21 / 29
+
75.86%
+
22 / 29
0.00% covered (danger) @@ -71,21 +71,21 @@ repos
-
- 95.69% covered (success) +
+ 96.65% covered (success)
-
95.69%
-
200 / 209
+
96.65%
+
202 / 209
-
- 76.00% covered (warning) +
+ 80.00% covered (warning)
-
76.00%
-
19 / 25
+
80.00%
+
20 / 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:26:02 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:34:44 UTC 2016.

diff --git a/coverage/repos/MedecinRepo.php.html b/coverage/repos/MedecinRepo.php.html index bf4f5ff..3ee9160 100755 --- a/coverage/repos/MedecinRepo.php.html +++ b/coverage/repos/MedecinRepo.php.html @@ -52,22 +52,22 @@
0.00%
0 / 1
-
- 71.43% covered (warning) +
+ 85.71% covered (warning)
-
71.43%
-
5 / 7
+
85.71%
+
6 / 7
CRAP
-
- 91.18% covered (success) +
+ 97.06% covered (success)
-
91.18%
-
31 / 34
+
97.06%
+
33 / 34
@@ -81,22 +81,22 @@
0.00%
0 / 1
-
- 71.43% covered (warning) +
+ 85.71% covered (warning)
-
71.43%
-
5 / 7
- 20.27 +
85.71%
+
6 / 7
+ 17
-
- 91.18% covered (success) +
+ 97.06% covered (success)
-
91.18%
-
31 / 34
+
97.06%
+
33 / 34
@@ -130,7 +130,7 @@
0.00%
0 / 1
- 5.03 + 3.01
88.89% covered (warning) @@ -172,7 +172,7 @@
100.00%
1 / 1
- 7 + 6
100.00% covered (success) @@ -226,24 +226,24 @@ -  update -
-
- 0.00% covered (danger) +  update +
+
+ 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 / 2
+
100.00%
+
2 / 2
@@ -264,46 +264,46 @@     public static function getById($id){ -         if(!StaticRepo::checkParam($id, 'Numeric')) return false; +         if(!StaticRepo::checkParam($id, 'Numeric')) return false; -         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Medecin WHERE Id = :id'); -         $req->execute(['id' => $id]); -         return StaticRepo::delNumeric( $req->fetch(), true ); +         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Medecin WHERE Id = :id'); +         $req->execute(['id' => $id]); +         return StaticRepo::delNumeric( $req->fetch(), true );     }     public static function add($civilite,$prenom,$nom){ -         if(!StaticRepo::checkParam($civilite,'Civilite') && !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')) return false; +         if(!StaticRepo::checkParam($civilite,'Civilite') | !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45')) return false; -         $req = StaticRepo::getConnexion()->prepare('INSERT INTO Medecin VALUES (DEFAULT,:civilite,:prenom,:nom)'); -         $result = $req->execute(['civilite' => $civilite, -             'nom' => $nom, -             'prenom' => $prenom +         $req = StaticRepo::getConnexion()->prepare('INSERT INTO Medecin VALUES (DEFAULT,:civilite,:prenom,:nom)'); +         $result = $req->execute(['civilite' => $civilite, +             'nom' => $nom, +             'prenom' => $prenom         ]);         //PDO renvoie un ID sous forme de char, on transtype -         $id = StaticRepo::getConnexion()->lastInsertId(); -         settype($id, 'integer'); +         $id = StaticRepo::getConnexion()->lastInsertId(); +         settype($id, 'integer'); -         if($result) return $id; +         if($result) return $id;         else        return false;     }     public static function delete($idMedecin){ -         if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; +         if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; -         var_dump($idMedecin); +         var_dump($idMedecin); -         $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); -         return $req->execute(['id' => $idMedecin]); +         $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); +         return $req->execute(['id' => $idMedecin]);     }     public static function search($nom, $prenom){ -         if( !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45') ) return false; +         if( !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45') ) return false;         // on définit les valeurs (peuvent être nulles)         $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; @@ -342,8 +342,8 @@     public static function update($id, $nom, $prenom){ -         $req = StaticRepo::getConnexion()->prepare("UPDATE Medecin SET Nom = :nom, Prenom = :prenom WHERE Id = :id"); -         return $req->execute([ ':nom' => strtoupper($nom), ':prenom' => $prenom, ':id' => $id ]); +         $req = StaticRepo::getConnexion()->prepare("UPDATE Medecin SET Nom = :nom, Prenom = :prenom WHERE Id = :id"); +         return $req->execute([ ':nom' => strtoupper($nom), ':prenom' => $prenom, ':id' => $id ]);     } } @@ -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:26:02 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:34:44 UTC 2016.

diff --git a/coverage/repos/PatientRepo.php.html b/coverage/repos/PatientRepo.php.html index f501eda..f0ff79c 100755 --- a/coverage/repos/PatientRepo.php.html +++ b/coverage/repos/PatientRepo.php.html @@ -88,7 +88,7 @@
71.43%
5 / 7
- 47 + 46
97.56% covered (success) @@ -214,7 +214,7 @@
100.00%
1 / 1
- 7 + 6
100.00% covered (success) @@ -386,7 +386,7 @@     public static function search($nom, $prenom){ -         if( !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45') ) return false; +         if( !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45') ) return false;         // on définit les valeurs (peuvent être nulles)         $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; @@ -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:26:02 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:34:44 UTC 2016.

diff --git a/coverage/repos/RDVRepo.php.html b/coverage/repos/RDVRepo.php.html index 6d44799..3596caf 100755 --- a/coverage/repos/RDVRepo.php.html +++ b/coverage/repos/RDVRepo.php.html @@ -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:26:02 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:34:44 UTC 2016.

diff --git a/coverage/repos/StatsRepo.php.html b/coverage/repos/StatsRepo.php.html index 0a7dd77..66b83a2 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:26:02 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:34:44 UTC 2016.

diff --git a/coverage/repos/dashboard.html b/coverage/repos/dashboard.html index 717ed5f..2d229e8 100755 --- a/coverage/repos/dashboard.html +++ b/coverage/repos/dashboard.html @@ -112,7 +112,6 @@ - update0% getAll86% add88% @@ -132,7 +131,7 @@ getAll5 - add5 + add3 @@ -142,7 +141,7 @@
@@ -181,7 +180,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,2,3,19], "Method Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,2,3,20], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -231,7 +230,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>"],[96.774193548387,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[97.058823529412,17,"MedecinRepo<\/a>"],[97.560975609756,46,"PatientRepo<\/a>"],[96.774193548387,25,"RDVRepo<\/a>"],[93.548387096774,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -255,7 +254,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>"],[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')) + .datum(getComplexityData([[100,2,"MedecinRepo::getById<\/a>"],[88.888888888889,3,"MedecinRepo::add<\/a>"],[100,2,"MedecinRepo::delete<\/a>"],[100,6,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,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,6,"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 a040bea..75178d7 100755 --- a/coverage/repos/index.html +++ b/coverage/repos/index.html @@ -44,21 +44,21 @@ Total
-
- 95.69% covered (success) +
+ 96.65% covered (success)
-
95.69%
-
200 / 209
+
96.65%
+
202 / 209
-
- 76.00% covered (warning) +
+ 80.00% covered (warning)
-
76.00%
-
19 / 25
+
80.00%
+
20 / 25
0.00% covered (danger) @@ -72,21 +72,21 @@ MedecinRepo.php
-
- 91.18% covered (success) +
+ 97.06% covered (success)
-
91.18%
-
31 / 34
+
97.06%
+
33 / 34
-
- 71.43% covered (warning) +
+ 85.71% covered (warning)
-
71.43%
-
5 / 7
+
85.71%
+
6 / 7
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:26:02 UTC 2016. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 17:34:44 UTC 2016.

diff --git a/repositories/repos/MedecinRepo.php b/repositories/repos/MedecinRepo.php index 6ef2e81..c53c489 100755 --- a/repositories/repos/MedecinRepo.php +++ b/repositories/repos/MedecinRepo.php @@ -21,7 +21,7 @@ class MedecinRepo public static function add($civilite,$prenom,$nom){ - if(!StaticRepo::checkParam($civilite,'Civilite') && !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')) return false; + if(!StaticRepo::checkParam($civilite,'Civilite') | !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45')) return false; $req = StaticRepo::getConnexion()->prepare('INSERT INTO Medecin VALUES (DEFAULT,:civilite,:prenom,:nom)'); $result = $req->execute(['civilite' => $civilite, @@ -50,7 +50,7 @@ class MedecinRepo public static function search($nom, $prenom){ - if( !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45') ) return false; + if( !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45') ) return false; // on définit les valeurs (peuvent être nulles) $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; diff --git a/repositories/repos/PatientRepo.php b/repositories/repos/PatientRepo.php index edc3743..bed59a4 100755 --- a/repositories/repos/PatientRepo.php +++ b/repositories/repos/PatientRepo.php @@ -133,7 +133,7 @@ class PatientRepo public static function search($nom, $prenom){ - if( !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45') ) return false; + if( !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45') ) return false; // on définit les valeurs (peuvent être nulles) $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; diff --git a/test/MedecinRepoTest.php b/test/MedecinRepoTest.php index cc161aa..2df169a 100755 --- a/test/MedecinRepoTest.php +++ b/test/MedecinRepoTest.php @@ -17,10 +17,14 @@ class MedecinRepoTest extends PHPUnit_Framework_TestCase public function testConstruct(){ $this->assertTrue(new MedecinRepo() instanceof MedecinRepo); } - public function testAddAndDelete(){ + public function testAddDeleteUpdate(){ $id = $this->repo->add('M','Lucas','Mascaro'); $this->assertNotNull($id); + $this->assertTrue($this->repo->update($id,'Mascara','Loucasse')); + $this->assertEquals($this->repo->getById($id)['Nom'],'MASCARA'); $this->assertTrue($this->repo->delete($id)); + + $this->assertFalse($this->repo->add('Z','Lucas','Mascaro')); } public function testSearch(){