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 @@
63
        }else{
64
65
            // on supprime les doublons des entrées (indice numérique) -
66
            foreach($fetchData as $i=>$val){  // pour toutes les entrées +
66
            foreach($fetchData as $i=>$val){ // pour toutes les entrées
67
                
68
                if( !mb_detect_encoding($val, 'UTF-8') )
69
                    $fetchData[$i] = utf8_encode($val);
70
-
71
                if( is_int($i) )                    // si l'indice est un entier -
72
                    unset( $fetchData[$i] );    // on le supprime +
71
                if( is_int($i) )             // si l'indice est un entier +
72
                    unset( $fetchData[$i] ); // on le supprime
73
            }
74
75
        } @@ -309,53 +309,57 @@
120
        switch($dbtype){
121
            // [1] 'M' / 'F' 
122
            case 'Civilite': -
123
                $checker = $checker && is_string($variable) && in_array($variable, ['M','F']); +
123
                $checker = $checker && !is_null($variable) && is_string($variable) && in_array($variable, ['M','F']);
124
                break;
125
126
            // [2] Chaine de caractère (longueur variable)
127
            case 'String': -
128
                $checker = $checker && is_string($variable) && strlen($variable) <= $len; +
128
                $checker = $checker && !is_null($variable) && is_string($variable) && strlen($variable) > 0 && strlen($variable) <= $len;
129
                break;
130
131
            case 'Integer': -
132
                $checker = $checker && is_int($variable) && $variable<pow(2, 32); -
133
                break; +
132
                $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 32); +
133
                break;
134
-
135
            case 'SmallInteger': -
136
                $checker = $checker && is_int($variable) && $variable<pow(2, 16); -
137
                break; +
135
            case 'Numeric': +
136
                $checker = $checker && !is_null($variable) && is_numeric($variable); +
137
                break;
138
-
139
            case 'TinyInteger': -
140
                $checker = $checker && is_int($variable) && $variable<pow(2, 8); +
139
            case 'SmallInteger': +
140
                $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 16);
141
                break;
142
-
143
            case 'BigInteger': -
144
                $checker = $checker && is_int($variable) && $variable<pow(2, 64); +
143
            case 'TinyInteger': +
144
                $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 8);
145
                break;
146
-
147
            case 'Date': -
148
                $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) ); -
149
                break; +
147
            case 'BigInteger': +
148
                $checker = $checker && !is_null($variable) && is_int($variable) && $variable<pow(2, 64); +
149
                break;
150
-
151
            case 'Heure': -
152
                $checker = $checker && is_string($variable) && preg_match('/(\d+):(\d+)/is',$variable); -
153
                break; +
151
            case 'Date': +
152
                $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) ); +
153
                break;
154
-
155
            // [N] Type inconnu -
156
            default: $checker = false; break; -
157
        } +
155
            case 'Heure': +
156
                $checker = $checker && !is_null($variable) && is_string($variable) && preg_match('/^\d{1,2}:\d{1,2}$/', $variable); +
157
                break;
158
-
159
-
160
        /* [3] On retourne le résultat de la vérif -
161
        =============================================================*/ -
162
        return $checker; +
159
            // [N] Type inconnu +
160
            default: $checker = false; break; +
161
        } +
162
163
-
164
    } -
165
-
166
-
167
} -
168
-
169
?> +
164
        /* [3] On retourne le résultat de la vérif +
165
        =============================================================*/ +
166
        return $checker; +
167
+
168
    } +
169
+
170
+
171
} +
172
+
173
?> @@ -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); } }