diff --git a/coverage/StaticRepo.php.html b/coverage/StaticRepo.php.html index 4e5ab09..92beda0 100755 --- a/coverage/StaticRepo.php.html +++ b/coverage/StaticRepo.php.html @@ -201,13 +201,13 @@
12
     * @return PDO instance de la connexion a la BDD
13
     */
14
    public static function getConnexion(){ -
15
        if(static::$config == null){ +
15
        if(static::$config == null){
16
            static::$config = json_decode(file_get_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.json'),true);
17
        } -
18
        if(static::$connexion == null){ +
18
        if(static::$connexion == null){
19
            static::$connexion = new PDO('mysql:host='.static::$config['host'].';dbname='.static::$config['database'], static::$config['login'], static::$config['password']);
20
        } -
21
        return static::$connexion; +
21
        return static::$connexion;
22
    }
23
24
    /** @@ -230,21 +230,21 @@
41
    public static function delNumeric($fetchData, $oneDimension=false){
42
    
43
    // cas où fetch renvoie FALSE -
44
    if( $fetchData === false ) return false; +
44
    if( $fetchData === false ) return false;
45
46
        /* [1] 2 dimensions
47
        ===============================================*/ -
48
        if( !$oneDimension ){ +
48
        if( !$oneDimension ){
49
50
        // on supprime les doublons des entrées (indice numérique) -
51
        for( $i = 0 ; $i < count($fetchData) ; $i++ ) // pour tout les utilisateurs -
52
            foreach($fetchData[$i] as $col => $val){  // pour toutes les entrées +
51
        for( $i = 0 ; $i < count($fetchData) ; $i++ ) // pour tout les utilisateurs +
52
            foreach($fetchData[$i] as $col => $val){  // pour toutes les entrées
53
                 -
54
                if( !mb_detect_encoding($val, 'UTF-8') ) +
54
                if( !mb_detect_encoding($val, 'UTF-8') )
55
                    $fetchData[$i][$col] = utf8_encode($val);
56
                 -
57
                if( is_int($col) )                    // si l'indice est un entier -
58
                    unset( $fetchData[$i][$col] );    // on le supprime +
57
                if( is_int($col) )                    // si l'indice est un entier +
58
                    unset( $fetchData[$i][$col] );    // on le supprime
59
            }
60
61
        /* [2] 1 dimensions @@ -263,7 +263,7 @@
74
75
        }
76
-
77
        return $fetchData; +
77
        return $fetchData;
78
    }
79
80
@@ -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); @@ -332,8 +332,8 @@
143
                break;
144
145
            case 'Date': -
146
                $checker = $checker && is_string($variable) && preg_match('/(\d+)\/(\d+)\/(\d+)/is',$variable); -
147
                break; +
146
                $checker = $checker && is_string($variable) && preg_match('/(\d+)\/(\d+)\/(\d+)/is',$variable); +
147
                break;
148
149
            case 'Heure':
150
                $checker = $checker && is_string($variable) && preg_match('/(\d+):(\d+)/is',$variable); @@ -346,7 +346,7 @@
157
158
        /* [3] On retourne le résultat de la vérif
159
        =============================================================*/ -
160
        return $checker; +
160
        return $checker;
161
162
    }
163
@@ -366,7 +366,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:46:08 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:51:32 UTC 2015.

diff --git a/coverage/dashboard.html b/coverage/dashboard.html index dbaded8..6c1a65c 100755 --- a/coverage/dashboard.html +++ b/coverage/dashboard.html @@ -59,7 +59,6 @@ StaticRepo84% - RDVRepo85% @@ -77,7 +76,6 @@ StaticRepo48 - RDVRepo19 @@ -115,10 +113,9 @@ - getByDate20% checkParam81% delNumeric85% - getAll85% + getAll86% add88% @@ -138,9 +135,8 @@ checkParam33 delNumeric10 + getAll5 add5 - getByDate4 - getAll4 @@ -150,7 +146,7 @@ @@ -171,7 +167,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 +185,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,1,0,0,0,0,0,4,4,17], "Method Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,4,4,18], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -239,7 +235,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[84.615384615385,42,"StaticRepo<\/a>"],[96.428571428571,15,"MedecinRepo<\/a>"],[96.875,39,"PatientRepo<\/a>"],[85.106382978723,18,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[84.615384615385,42,"StaticRepo<\/a>"],[96.428571428571,15,"MedecinRepo<\/a>"],[96.875,39,"PatientRepo<\/a>"],[94,22,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -263,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>"],[81.25,28,"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>"],[95.652173913043,14,"PatientRepo::add<\/a>"],[96,14,"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>"],[20,2,"RDVRepo::getByDate<\/a>"],[100,2,"RDVRepo::delete<\/a>"],[91.666666666667,6,"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>"],[81.25,28,"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>"],[95.652173913043,14,"PatientRepo::add<\/a>"],[96,14,"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>"],[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 90c22c9..d3a53a6 100755 --- a/coverage/index.html +++ b/coverage/index.html @@ -43,21 +43,21 @@ Total
-
- 90.78% covered (success) +
+ 92.73% covered (success)
-
90.78%
-
197 / 217
+
92.73%
+
204 / 220
-
- 65.38% covered (warning) +
+ 69.23% covered (warning)
-
65.38%
-
17 / 26
+
69.23%
+
18 / 26
0.00% covered (danger) @@ -71,21 +71,21 @@ repos
-
- 92.73% covered (success) +
+ 95.24% covered (success)
-
92.73%
-
153 / 165
+
95.24%
+
160 / 168
-
- 68.18% covered (warning) +
+ 72.73% covered (warning)
-
68.18%
-
15 / 22
+
72.73%
+
16 / 22
0.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.0 at Thu Dec 10 10:46:08 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:51:32 UTC 2015.

diff --git a/coverage/repos/MedecinRepo.php.html b/coverage/repos/MedecinRepo.php.html index 644839d..04424d7 100755 --- a/coverage/repos/MedecinRepo.php.html +++ b/coverage/repos/MedecinRepo.php.html @@ -318,7 +318,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:46:08 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:51:32 UTC 2015.

diff --git a/coverage/repos/PatientRepo.php.html b/coverage/repos/PatientRepo.php.html index 590790d..b2e260e 100755 --- a/coverage/repos/PatientRepo.php.html +++ b/coverage/repos/PatientRepo.php.html @@ -385,7 +385,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:46:08 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:51:32 UTC 2015.

diff --git a/coverage/repos/RDVRepo.php.html b/coverage/repos/RDVRepo.php.html index 2967ba9..e1fa590 100755 --- a/coverage/repos/RDVRepo.php.html +++ b/coverage/repos/RDVRepo.php.html @@ -52,22 +52,22 @@
0.00%
0 / 1
-
- 57.14% covered (warning) +
+ 71.43% covered (warning)
-
57.14%
-
4 / 7
+
71.43%
+
5 / 7
CRAP -
-
- 85.11% covered (warning) +
+
+ 94.00% covered (success)
-
85.11%
-
40 / 47
+
94.00%
+
47 / 50
@@ -81,22 +81,22 @@
0.00%
0 / 1
-
- 57.14% covered (warning) +
+ 71.43% covered (warning)
-
57.14%
-
4 / 7
- 19.07 -
-
- 85.11% covered (warning) +
71.43%
+
5 / 7
+ 22.10 +
+
+ 94.00% covered (success)
-
85.11%
-
40 / 47
+
94.00%
+
47 / 50
@@ -121,24 +121,24 @@ -  getByDate -
-
- 0.00% covered (danger) +  getByDate +
+
+ 100.00% covered (success)
-
0.00%
-
0 / 1
- 4.05 -
-
- 20.00% covered (danger) +
100.00%
+
1 / 1
+ 2 +
+
+ 100.00% covered (success)
-
20.00%
-
1 / 5
+
100.00%
+
5 / 5
@@ -193,28 +193,7 @@
100.00%
1 / 1
- 1 -
-
- 100.00% covered (success) -
-
- -
100.00%
-
4 / 4
- - - -  getByPatientAndDate -
-
- 100.00% covered (success) -
-
- -
100.00%
-
1 / 1
- 1 + 2
100.00% covered (success) @@ -226,7 +205,28 @@ -  getAll +  getByPatientAndDate +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 3 +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
6 / 6
+ + + +  getAll
0.00% covered (danger) @@ -235,15 +235,15 @@
0.00%
0 / 1
- 4.05 + 5.06
-
- 85.71% covered (warning) +
+ 86.67% covered (warning)
-
85.71%
-
12 / 14
+
86.67%
+
13 / 15
@@ -274,12 +274,12 @@     public static function getByDate($date){ -         if(!StaticRepo::checkParam($date,'Date')){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',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){ @@ -310,40 +310,49 @@     }     public static function updateDateTime($idRDV,$dateTime){ -         $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){ -         $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){ -         $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()); -     } - - } + +         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){ + +         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()); +     } + + } @@ -356,7 +365,7 @@ Dead Code

- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:46:08 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:51:32 UTC 2015.

diff --git a/coverage/repos/StatsRepo.php.html b/coverage/repos/StatsRepo.php.html index dd23b07..797197a 100755 --- 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 10:46:08 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:51:32 UTC 2015.

diff --git a/coverage/repos/dashboard.html b/coverage/repos/dashboard.html index ce784c4..c1336f4 100755 --- a/coverage/repos/dashboard.html +++ b/coverage/repos/dashboard.html @@ -59,7 +59,6 @@ - RDVRepo85% @@ -76,7 +75,6 @@ - RDVRepo19 @@ -114,8 +112,7 @@ - getByDate20% - getAll85% + getAll86% add88% @@ -133,9 +130,8 @@ + getAll5 add5 - getByDate4 - getAll4 @@ -145,7 +141,7 @@
@@ -166,7 +162,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 +180,7 @@ $(document).ready(function() { .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,1,0,0,0,0,0,2,4,15], "Method Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,2,4,16], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -234,7 +230,7 @@ $(document).ready(function() { chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[96.428571428571,15,"MedecinRepo<\/a>"],[96.875,39,"PatientRepo<\/a>"],[85.106382978723,18,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[96.428571428571,15,"MedecinRepo<\/a>"],[96.875,39,"PatientRepo<\/a>"],[94,22,"RDVRepo<\/a>"],[92.307692307692,9,"StatsRepo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -258,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,3,"MedecinRepo::search<\/a>"],[100,2,"MedecinRepo::getPatients<\/a>"],[100,1,"MedecinRepo::getAll<\/a>"],[100,2,"PatientRepo::getById<\/a>"],[95.652173913043,14,"PatientRepo::add<\/a>"],[96,14,"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>"],[20,2,"RDVRepo::getByDate<\/a>"],[100,2,"RDVRepo::delete<\/a>"],[91.666666666667,6,"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>"],[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>"],[95.652173913043,14,"PatientRepo::add<\/a>"],[96,14,"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>"],[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 7a0134b..2832cc7 100755 --- a/coverage/repos/index.html +++ b/coverage/repos/index.html @@ -44,21 +44,21 @@ Total
-
- 92.73% covered (success) +
+ 95.24% covered (success)
-
92.73%
-
153 / 165
+
95.24%
+
160 / 168
-
- 68.18% covered (warning) +
+ 72.73% covered (warning)
-
68.18%
-
15 / 22
+
72.73%
+
16 / 22
0.00% covered (danger) @@ -126,23 +126,23 @@ - RDVRepo.php -
-
- 85.11% covered (warning) + RDVRepo.php +
+
+ 94.00% covered (success)
-
85.11%
-
40 / 47
+
94.00%
+
47 / 50
-
- 57.14% covered (warning) +
+ 71.43% covered (warning)
-
57.14%
-
4 / 7
+
71.43%
+
5 / 7
0.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.0 at Thu Dec 10 10:46:08 UTC 2015. + Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.0 and PHPUnit 5.1.0 at Thu Dec 10 10:51:32 UTC 2015.

diff --git a/repositories/repos/RDVRepo.php b/repositories/repos/RDVRepo.php index 8c8738d..a61bae6 100755 --- a/repositories/repos/RDVRepo.php +++ b/repositories/repos/RDVRepo.php @@ -57,6 +57,9 @@ class RDVRepo } 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, @@ -64,6 +67,9 @@ class RDVRepo } 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, @@ -72,6 +78,9 @@ class RDVRepo } public static function getAll($date = 0){ + + if(!StaticRepo::checkParam($date,'Integer')){return false;} + $dateTime = date('Y-m-d',time()); switch($date){ case -1: diff --git a/test/RDVRepoTest.php b/test/RDVRepoTest.php index 5a9d04a..33dee1e 100755 --- a/test/RDVRepoTest.php +++ b/test/RDVRepoTest.php @@ -41,7 +41,7 @@ class RDVRepoTest extends PHPUnit_Framework_TestCase 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))); + $result = $this->repo->getByDate($date = date('Y/m/d',strtotime($date))); $this->assertTrue(isset($result[0])); $this->assertEquals($result[0]['Id'],1); }