diff --git a/coverage/StaticRepo.php.html b/coverage/StaticRepo.php.html index 6552234..48717c9 100644 --- a/coverage/StaticRepo.php.html +++ b/coverage/StaticRepo.php.html @@ -291,22 +291,22 @@
102
    public static function checkParam($variable, $dbtype){
103
        /* [1] on vérifie que $dbtype est un String
104
        =============================================================*/ -
105
        if( !is_string($dbtype) ) return false; +
105
        if( !is_string($dbtype) ) return false;
106
107
108
        /* [2] Vérifications
109
        =============================================================*/ -
110
        $checker = true; // contiendra VRAI si la vérification s'avère correcte -
111
        $matches = []; +
110
        $checker = true; // contiendra VRAI si la vérification s'avère correcte +
111
        $matches = [];
112
        //si on a un type scalairexlongueur, on traite -
113
        if(preg_match_all('/((?:[a-z][a-z]+))(\\d+)/is',$dbtype,$matches)){ +
113
        if(preg_match_all('/((?:[a-z][a-z]+))(\\d+)/is',$dbtype,$matches)){
114
            $dbtype = $matches[1][0];
115
            isset($matches[2][0])? $len = $matches[2][0] : $len = 8;
116
        }
117
118
        switch($dbtype){
119
            // [1] 'M' / 'F'  -
120
            case 'Civilite': +
120
            case 'Civilite':
121
                $checker = $checker && is_string($variable) && in_array($variable,['M','F']);
122
                break;
123
@@ -316,8 +316,8 @@
127
                break;
128
129
            case 'Integer': -
130
                $checker = $checker && is_int($variable) && $variable<pow(2,32); -
131
                break; +
130
                $checker = $checker && is_int($variable) && $variable<pow(2,32); +
131
                break;
132
133
            case 'SmallInteger':
134
                $checker = $checker && is_int($variable) && $variable<pow(2,16); @@ -338,7 +338,7 @@
149
150
        /* [3] On retourne le résultat de la vérif
151
        =============================================================*/ -
152
        return $checker; +
152
        return $checker;
153
154
    }
155
@@ -358,7 +358,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 9:54:17 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:12:27 UTC 2015.

diff --git a/coverage/dashboard.html b/coverage/dashboard.html index a474818..40c609b 100644 --- a/coverage/dashboard.html +++ b/coverage/dashboard.html @@ -148,7 +148,7 @@ @@ -237,7 +237,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[86.95652173913,36,"StaticRepo<\/a>"],[95.652173913043,11,"MedecinRepo<\/a>"],[95.652173913043,9,"PatientRepo<\/a>"],[92.682926829268,11,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[86.95652173913,36,"StaticRepo<\/a>"],[95.833333333333,12,"MedecinRepo<\/a>"],[95.652173913043,9,"PatientRepo<\/a>"],[92.682926829268,11,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -261,7 +261,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>"],[84.615384615385,22,"StaticRepo::checkParam<\/a>"],[100,2,"MedecinRepo::getById<\/a>"],[85.714285714286,5,"MedecinRepo::add<\/a>"],[100,1,"MedecinRepo::delete<\/a>"],[100,1,"MedecinRepo::search<\/a>"],[100,1,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,1,"PatientRepo::getById<\/a>"],[93.75,2,"PatientRepo::add<\/a>"],[94.444444444444,2,"PatientRepo::update<\/a>"],[100,1,"PatientRepo::delete<\/a>"],[100,1,"PatientRepo::updateMedecinTraitant<\/a>"],[100,1,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,1,"RDVRepo::getById<\/a>"],[100,1,"RDVRepo::getByDate<\/a>"],[100,1,"RDVRepo::delete<\/a>"],[88.888888888889,2,"RDVRepo::add<\/a>"],[100,1,"RDVRepo::updateDateTime<\/a>"],[100,1,"RDVRepo::getByPatientAndDate<\/a>"],[85.714285714286,4,"RDVRepo::getAll<\/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>"],[84.615384615385,22,"StaticRepo::checkParam<\/a>"],[100,2,"MedecinRepo::getById<\/a>"],[85.714285714286,5,"MedecinRepo::add<\/a>"],[100,1,"MedecinRepo::delete<\/a>"],[100,1,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,1,"PatientRepo::getById<\/a>"],[93.75,2,"PatientRepo::add<\/a>"],[94.444444444444,2,"PatientRepo::update<\/a>"],[100,1,"PatientRepo::delete<\/a>"],[100,1,"PatientRepo::updateMedecinTraitant<\/a>"],[100,1,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,1,"RDVRepo::getById<\/a>"],[100,1,"RDVRepo::getByDate<\/a>"],[100,1,"RDVRepo::delete<\/a>"],[88.888888888889,2,"RDVRepo::add<\/a>"],[100,1,"RDVRepo::updateDateTime<\/a>"],[100,1,"RDVRepo::getByPatientAndDate<\/a>"],[85.714285714286,4,"RDVRepo::getAll<\/a>"],[91.304347826087,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 a9c8bff..277eb67 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -43,13 +43,13 @@ Total
-
- 92.31% covered (success) +
+ 92.35% covered (success)
-
92.31%
-
168 / 182
+
92.35%
+
169 / 183
69.23% covered (warning) @@ -71,13 +71,13 @@ repos
-
- 94.12% covered (success) +
+ 94.16% covered (success)
-
94.12%
-
128 / 136
+
94.16%
+
129 / 137
72.73% covered (warning) @@ -136,7 +136,7 @@ High: 90% to 100%

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 9:54:17 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:12:27 UTC 2015.

diff --git a/coverage/repos/MedecinRepo.php.html b/coverage/repos/MedecinRepo.php.html index a827db2..cc941fd 100644 --- a/coverage/repos/MedecinRepo.php.html +++ b/coverage/repos/MedecinRepo.php.html @@ -61,13 +61,13 @@
5 / 6
CRAP
-
- 95.65% covered (success) +
+ 95.83% covered (success)
-
95.65%
-
22 / 23
+
95.83%
+
23 / 24
@@ -88,15 +88,15 @@
83.33%
5 / 6
- 11 + 12
-
- 95.65% covered (success) +
+ 95.83% covered (success)
-
95.65%
-
22 / 23
+
95.83%
+
23 / 24
@@ -193,7 +193,7 @@
100.00%
1 / 1
- 1 + 2
100.00% covered (success) @@ -201,11 +201,11 @@
100.00%
-
4 / 4
+
5 / 5
-  getAll +  getAll
100.00% covered (success) @@ -278,23 +278,25 @@     public static function getPatients($idMedecin){ -         $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(){ +         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()); +     } -         $req = StaticRepo::getConnexion()->query('SELECT * FROM Medecin ORDER BY nom, prenom ASC'); +     public static function getAll(){ -         return StaticRepo::delNumeric( $req->fetchAll() ); +         $req = StaticRepo::getConnexion()->query('SELECT * FROM Medecin ORDER BY nom, prenom ASC'); -     } +         return StaticRepo::delNumeric( $req->fetchAll() ); - } +     } + + } @@ -307,7 +309,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 9:54:17 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:12:27 UTC 2015.

diff --git a/coverage/repos/PatientRepo.php.html b/coverage/repos/PatientRepo.php.html index 597fb60..0533854 100644 --- a/coverage/repos/PatientRepo.php.html +++ b/coverage/repos/PatientRepo.php.html @@ -100,7 +100,7 @@ -  getById +  getById
100.00% covered (success) @@ -121,7 +121,7 @@ -  add +  add
0.00% covered (danger) @@ -142,7 +142,7 @@ -  update +  update
0.00% covered (danger) @@ -163,7 +163,7 @@ -  delete +  delete
100.00% covered (success) @@ -184,7 +184,7 @@ -  updateMedecinTraitant +  updateMedecinTraitant
100.00% covered (success) @@ -205,7 +205,7 @@ -  search +  search
100.00% covered (success) @@ -226,7 +226,7 @@ -  getAll +  getAll
100.00% covered (success) @@ -261,95 +261,96 @@  */ class PatientRepo { -     // private $connexion; +     public static function getById($id){ -     // public function __construct(){ -     //     StaticRepo::getConnexion() = StaticRepo::getConnexion(); -     // } - -     public static function getById($id){ -         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Patient WHERE Id = :id'); -         $req->execute(['id' => $id]); -         return StaticRepo::delNumeric( $req->fetch(), true ); - -     } - -     public static function add($civilite,$prenom,$nom,$adresse,$adresse2,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){ +         //if(!StaticRepo::checkParam($id,'Integer')){print_r(is_int($id));} + +         $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Patient WHERE Id = :id'); +         $req->execute(['id' => $id]); +         return StaticRepo::delNumeric( $req->fetch(), true ); + +     } + +     public static function add($civilite,$prenom,$nom,$adresse,$adresse2,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){ + +         $dateNaissance = strtotime($dateNaissance); +         $dateNaissance = Date('o-m-d',$dateNaissance); -         $dateNaissance = strtotime($dateNaissance); -         $dateNaissance = Date('o-m-d',$dateNaissance); - -         $req = StaticRepo::getConnexion()->prepare('INSERT INTO Patient VALUES (DEFAULT,:civilite,:nom,:prenom,:adresse,:adresse2,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,:medecin)'); -         $result = $req->execute(['civilite' => $civilite, -             'nom' => $nom, -             'prenom' => $prenom, -             'adresse' => $adresse, -             'adresse2' => $adresse2, -             'ville' => $ville, -             'codePostal' => $codePostal, -             'dateNaissance' => $dateNaissance, -             'lieuNaissance' => $lieuNaissance, -             'numSecu' => $numSecu, -             'medecin' => $medecinTraitant ]); -         if($result){return StaticRepo::getConnexion()->lastInsertId();} -         else{return false;} - -     } - -     public static function update($id,$civilite,$prenom,$nom,$adresse,$adresse2,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant){ -         $dateNaissance = strtotime($dateNaissance); -         $dateNaissance = Date('o-m-d',$dateNaissance); - -         $req = StaticRepo::getConnexion()->prepare('UPDATE Patient SET Civilite=:civilite,Nom=:nom,Prenom=:prenom,Adresse=:adresse,Adresse2=:adresse2,Ville=:ville, -         CodePostal=:codePostal,DateNaissance=:dateNaissance,LieuNaissance=:lieuNaissance,NumSecuriteSociale=:numSecu,MedecinTraitant=:medecin WHERE Id=:id;'); -         $result = $req->execute(['civilite' => $civilite, -             'nom' => $nom, -             'prenom' => $prenom, -             'adresse' => $adresse, -             'adresse2' => $adresse2, -             'ville' => $ville, -             'codePostal' => $codePostal, -             'dateNaissance' => $dateNaissance, -             'lieuNaissance' => $lieuNaissance, -             'numSecu' => $numSecu, -             'medecin' => $medecinTraitant, -             'id' => $id]); -         if($result){return StaticRepo::getConnexion()->lastInsertId();} -         else{return false;} - -     } - -     public static function delete($idPatient){ - -         $req = StaticRepo::getConnexion()->prepare('DELETE FROM Patient WHERE Patient.Id = :id'); -         return $req->execute(['id' => $idPatient]); - -     } - -     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]); - -     } - -     public static function search($nom,$prenom){ - -         $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() ); - -     } - - } +         $req = StaticRepo::getConnexion()->prepare('INSERT INTO Patient VALUES (DEFAULT,:civilite,:nom,:prenom,:adresse,:adresse2,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,:medecin)'); +         $result = $req->execute(['civilite' => $civilite, +             'nom' => $nom, +             'prenom' => $prenom, +             'adresse' => $adresse, +             'adresse2' => $adresse2, +             'ville' => $ville, +             'codePostal' => $codePostal, +             'dateNaissance' => $dateNaissance, +             'lieuNaissance' => $lieuNaissance, +             'numSecu' => $numSecu, +             'medecin' => $medecinTraitant ]); +         if($result){return StaticRepo::getConnexion()->lastInsertId();} +         else{return false;} + +     } + +     public static function update($id,$civilite,$prenom,$nom,$adresse,$adresse2,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant){ +         $dateNaissance = strtotime($dateNaissance); +         $dateNaissance = Date('o-m-d',$dateNaissance); + +         $req = StaticRepo::getConnexion()->prepare('UPDATE Patient SET Civilite=:civilite,Nom=:nom,Prenom=:prenom,Adresse=:adresse,Adresse2=:adresse2,Ville=:ville, +         CodePostal=:codePostal,DateNaissance=:dateNaissance,LieuNaissance=:lieuNaissance,NumSecuriteSociale=:numSecu,MedecinTraitant=:medecin WHERE Id=:id;'); +         $result = $req->execute(['civilite' => $civilite, +             'nom' => $nom, +             'prenom' => $prenom, +             'adresse' => $adresse, +             'adresse2' => $adresse2, +             'ville' => $ville, +             'codePostal' => $codePostal, +             'dateNaissance' => $dateNaissance, +             'lieuNaissance' => $lieuNaissance, +             'numSecu' => $numSecu, +             'medecin' => $medecinTraitant, +             'id' => $id]); +         if($result){return StaticRepo::getConnexion()->lastInsertId();} +         else{return false;} + +     } + +     public static function delete($idPatient){ + +         //if(!StaticRepo::checkParam($idPatient,'Integer')){ printf($idPatient);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;} + +         $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){ + +         $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() ); + +     } + + } @@ -362,7 +363,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 9:54:17 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:12:27 UTC 2015.

diff --git a/coverage/repos/RDVRepo.php.html b/coverage/repos/RDVRepo.php.html index e972094..20da2c0 100644 --- a/coverage/repos/RDVRepo.php.html +++ b/coverage/repos/RDVRepo.php.html @@ -341,7 +341,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 9:54:17 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:12:27 UTC 2015.

diff --git a/coverage/repos/StatsRepo.php.html b/coverage/repos/StatsRepo.php.html index 6dc50e8..59c7604 100644 --- a/coverage/repos/StatsRepo.php.html +++ b/coverage/repos/StatsRepo.php.html @@ -213,7 +213,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 9:54:17 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:12:27 UTC 2015.

diff --git a/coverage/repos/dashboard.html b/coverage/repos/dashboard.html index fb456a7..8b92fa9 100644 --- a/coverage/repos/dashboard.html +++ b/coverage/repos/dashboard.html @@ -143,7 +143,7 @@
@@ -232,7 +232,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[95.652173913043,11,"MedecinRepo<\/a>"],[95.652173913043,9,"PatientRepo<\/a>"],[92.682926829268,11,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[95.833333333333,12,"MedecinRepo<\/a>"],[95.652173913043,9,"PatientRepo<\/a>"],[92.682926829268,11,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -256,7 +256,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[100,2,"MedecinRepo::getById<\/a>"],[85.714285714286,5,"MedecinRepo::add<\/a>"],[100,1,"MedecinRepo::delete<\/a>"],[100,1,"MedecinRepo::search<\/a>"],[100,1,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,1,"PatientRepo::getById<\/a>"],[93.75,2,"PatientRepo::add<\/a>"],[94.444444444444,2,"PatientRepo::update<\/a>"],[100,1,"PatientRepo::delete<\/a>"],[100,1,"PatientRepo::updateMedecinTraitant<\/a>"],[100,1,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,1,"RDVRepo::getById<\/a>"],[100,1,"RDVRepo::getByDate<\/a>"],[100,1,"RDVRepo::delete<\/a>"],[88.888888888889,2,"RDVRepo::add<\/a>"],[100,1,"RDVRepo::updateDateTime<\/a>"],[100,1,"RDVRepo::getByPatientAndDate<\/a>"],[85.714285714286,4,"RDVRepo::getAll<\/a>"],[91.304347826087,8,"StatsRepo::getAgePatient<\/a>"],[100,1,"StatsRepo::getRDVStat<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[100,2,"MedecinRepo::getById<\/a>"],[85.714285714286,5,"MedecinRepo::add<\/a>"],[100,1,"MedecinRepo::delete<\/a>"],[100,1,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,1,"PatientRepo::getById<\/a>"],[93.75,2,"PatientRepo::add<\/a>"],[94.444444444444,2,"PatientRepo::update<\/a>"],[100,1,"PatientRepo::delete<\/a>"],[100,1,"PatientRepo::updateMedecinTraitant<\/a>"],[100,1,"PatientRepo::search<\/a>"],[100,1,"PatientRepo::getAll<\/a>"],[100,1,"RDVRepo::getById<\/a>"],[100,1,"RDVRepo::getByDate<\/a>"],[100,1,"RDVRepo::delete<\/a>"],[88.888888888889,2,"RDVRepo::add<\/a>"],[100,1,"RDVRepo::updateDateTime<\/a>"],[100,1,"RDVRepo::getByPatientAndDate<\/a>"],[85.714285714286,4,"RDVRepo::getAll<\/a>"],[91.304347826087,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 674c43c..013dbc9 100644 --- a/coverage/repos/index.html +++ b/coverage/repos/index.html @@ -44,13 +44,13 @@ Total
-
- 94.12% covered (success) +
+ 94.16% covered (success)
-
94.12%
-
128 / 136
+
94.16%
+
129 / 137
72.73% covered (warning) @@ -72,13 +72,13 @@ MedecinRepo.php
-
- 95.65% covered (success) +
+ 95.83% covered (success)
-
95.65%
-
22 / 23
+
95.83%
+
23 / 24
83.33% covered (warning) @@ -193,7 +193,7 @@ High: 90% to 100%

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 9:54:17 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:12:27 UTC 2015.

diff --git a/managers/Patient.class.php b/managers/Patient.class.php index c75dfe5..b7514c9 100644 --- a/managers/Patient.class.php +++ b/managers/Patient.class.php @@ -9,29 +9,29 @@ class Patient { public function add($params){ - $params['date_naissance'] = DateTime::createFromFormat('d-m-Y', $params['date_naissance']); - if(PatientRepo::add($params['civilite'],strtolower($params['prenom']),strtolower($params['nom']),$params['adresse'],$params['adresse2'],$params['ville'],$params['cope_postal'], + $params['date_naissance'] = DateTime::createFromFormat('d/m/Y', $params['date_naissance']); + if(PatientRepo::add($params['civilite'],strtolower($params['prenom']),strtolower($params['nom']),$params['adresse'],$params['adresse2'],$params['ville'],$params['code_postal'], $params['date_naissance']->format('Y-m-d'),$params['lieu_naissance'],$params['num_secu'],$params['medecin_traitant']) !==FALSE){ $response = new Response(); - $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/index.php?type=creation"); + $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=creation"); $response->send(); }else{ $response = new Response(500); - $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/index.php?type=error"); + $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error"); $response->send(); } } public function update($params){ - $params['date_naissance'] = DateTime::createFromFormat('d-m-Y', $params['date_naissance']); + $params['date_naissance'] = DateTime::createFromFormat('d/m/Y', $params['date_naissance']); if(PatientRepo::update($params['id_patient'],$params['civilite'],strtolower($params['prenom']),strtolower($params['nom']),$params['adresse'],$params['adresse2'],$params['ville'],$params['cope_postal'], $params['date_naissance']->format('Y-m-d'),$params['lieu_naissance'],$params['num_secu'],$params['medecin_traitant']) !==FALSE){ $response = new Response(); - $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/index.php?type=creation"); + $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=creation"); $response->send(); }else{ $response = new Response(500); - $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/index.php?type=error"); + $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error"); $response->send(); } } diff --git a/managers/RDV.class.php b/managers/RDV.class.php index 95ec47d..e4c7075 100644 --- a/managers/RDV.class.php +++ b/managers/RDV.class.php @@ -9,7 +9,7 @@ class RDV { public function add($params){ - $params['date'] = DateTime::createFromFormat('d-m-Y', $params['date']); + $params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']); if(RDVRepo::add($params['date']->format('Y-m-d').' '.$params['heure'].':00',$params['duree'],$params['id_patient'],$params['id_medecin']) !==FALSE){ $response = new Response(); $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=creation"); @@ -34,7 +34,7 @@ class RDV } public function update($params){ - $params['date'] = DateTime::createFromFormat('d-m-Y', $params['date']); + $params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']); if(RDVRepo::updateDateTime($params['id_consultation'],$params['date']->format('Y-m-d').' '.$params['heure'].':00') !==FALSE){ $response = new Response(); $response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=maj"); diff --git a/repositories/repos/PatientRepo.php b/repositories/repos/PatientRepo.php index cb4c2c9..d97c628 100755 --- a/repositories/repos/PatientRepo.php +++ b/repositories/repos/PatientRepo.php @@ -8,15 +8,9 @@ */ class PatientRepo { - // private $connexion; - - // public function __construct(){ - // StaticRepo::getConnexion() = StaticRepo::getConnexion(); - // } - public static function getById($id){ - if(!StaticRepo::checkParam($id,'Integer')){return false;} + //if(!StaticRepo::checkParam($id,'Integer')){print_r(is_int($id));} $req = StaticRepo::getConnexion()->prepare('SELECT * FROM Patient WHERE Id = :id'); $req->execute(['id' => $id]); @@ -71,7 +65,7 @@ class PatientRepo public static function delete($idPatient){ - if(!StaticRepo::checkParam($idPatient,'Integer')){return false;} + //if(!StaticRepo::checkParam($idPatient,'Integer')){ printf($idPatient);return false;} $req = StaticRepo::getConnexion()->prepare('DELETE FROM Patient WHERE Patient.Id = :id'); return $req->execute(['id' => $idPatient]); @@ -80,7 +74,7 @@ class PatientRepo public static function updateMedecinTraitant($idPatient,$idMedecin){ - if(!StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($idMedecin,'Integer')){return false;} + //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]);