diff --git a/phpunit/coverage/Database.php.html b/phpunit/coverage/Database.php.html index 177a9f5..9e875c5 100755 --- a/phpunit/coverage/Database.php.html +++ b/phpunit/coverage/Database.php.html @@ -645,7 +645,7 @@ Dead Code

- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 9:10:21 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 13:45:11 UTC 2016.

diff --git a/phpunit/coverage/ManagerError.php.html b/phpunit/coverage/ManagerError.php.html index aa77299..0ff813d 100755 --- a/phpunit/coverage/ManagerError.php.html +++ b/phpunit/coverage/ManagerError.php.html @@ -66,7 +66,7 @@
100.00%
-
18 / 18
+
19 / 19
@@ -87,7 +87,7 @@
100.00%
1 / 1
- 18 + 19
100.00% covered (success) @@ -95,11 +95,11 @@
100.00%
-
18 / 18
+
19 / 19
-  explicit +  explicit
100.00% covered (success) @@ -108,7 +108,7 @@
100.00%
1 / 1
- 18 + 19
100.00% covered (success) @@ -116,7 +116,7 @@
100.00%
-
18 / 18
+
19 / 19
@@ -192,49 +192,53 @@
66
67
            const PermissionError     = 16;
68
-
69
-
70
        /* EXPLICITE UN CODE D'ERREUR -
71
        * -
72
        * @error<Integer>                                     Code d'erreur -
73
        * -
74
        * @return explicit<String>                             Description explicite du code d'erreur -
75
        * -
76
        */ -
77
        public static function explicit($error){ -
78
            switch($error){ -
79
                case self::Success:             return "Tout s'est bien deroule";                                             break; -
80
-
81
                case self::ParsingFailed:       return "La lecture du fichier JSON ou XML a echoue";                          break; -
82
-
83
                case self::InvalidFlags:        return "Les specifications (drapeaux) sont incorrects";                       break; -
84
                case self::UnreachableResource: return "La ressource n'existe pas (404)";                                     break; -
85
                case self::MissingPath:         return "Le chemin de delegation n'a pas ete renseigne";                       break; -
86
                case self::WrongPathModule:     return "Le chemin de delegation est incorrect ('nomModule/nomMethode')";      break; -
87
                case self::WrongPathRepo:       return "Le chemin de delegation est incorrect ('nomRepo/nomMethode')";        break; -
88
                case self::UnknownModule:       return "Le module n'existe pas";                                              break; -
89
                case self::UnknownRepo:         return "Le repo n'existe pas";                                                break; -
90
                case self::UnknownMethod:       return "Le methode n'existe pas";                                             break; -
91
                case self::UncallableMethod:    return "Le methode n'est pas amorcable";                                      break; -
92
-
93
                case self::ParamError:          return "Un ou plusieurs parametres sont manquants ou incorrects";             break; -
94
                case self::ModuleError:         return "Erreur lors du traitement du module";                                 break; -
95
                case self::RepoError:           return "Erreur lors du traitement du repo";                                   break; -
96
-
97
                case self::PDOConnection:       return "La connexion avec la base de donnees a echoue";                       break; -
98
-
99
                case self::TokenError:          return "Le token de connection est absent ou errone";                         break; -
100
                case self::PermissionError:     return "Vous n'avez pas la permission d'effectuer cette action";              break; +
69
        /* Erreur d'UPLOAD */ +
70
            const UploadError         = 17; +
71
+
72
+
73
        /* EXPLICITE UN CODE D'ERREUR +
74
        * +
75
        * @error<Integer>                                     Code d'erreur +
76
        * +
77
        * @return explicit<String>                             Description explicite du code d'erreur +
78
        * +
79
        */ +
80
        public static function explicit($error){ +
81
            switch($error){ +
82
                case self::Success:             return "Tout s'est bien deroulé.";                                             break; +
83
+
84
                case self::ParsingFailed:       return "La lecture du fichier JSON ou XML a echouée.";                         break; +
85
+
86
                case self::InvalidFlags:        return "Les spécifications (drapeaux) sont incorrects.";                       break; +
87
                case self::UnreachableResource: return "La ressource n'existe pas (404).";                                     break; +
88
                case self::MissingPath:         return "Le chemin de délégation n'a pas été renseigné.";                       break; +
89
                case self::WrongPathModule:     return "Le chemin de délégation est incorrect ('nomModule/nomMethode').";      break; +
90
                case self::WrongPathRepo:       return "Le chemin de délégation est incorrect ('nomRepo/nomMethode').";        break; +
91
                case self::UnknownModule:       return "Le module n'existe pas.";                                              break; +
92
                case self::UnknownRepo:         return "Le repo n'existe pas.";                                                break; +
93
                case self::UnknownMethod:       return "Le methode n'existe pas.";                                             break; +
94
                case self::UncallableMethod:    return "Le methode n'est pas amorçable.";                                      break; +
95
+
96
                case self::ParamError:          return "Un ou plusieurs paramètres sont manquants ou incorrects.";             break; +
97
                case self::ModuleError:         return "Erreur lors du traitement du module.";                                 break; +
98
                case self::RepoError:           return "Erreur lors du traitement du repo.";                                   break; +
99
+
100
                case self::PDOConnection:       return "La connexion avec la base de données a echouée.";                      break;
101
-
102
                // default:                        return "Erreur inconnue...";                                                  break; -
103
            } -
104
-
105
            // Erreur inconnue -
106
            return null; -
107
        } +
102
                case self::TokenError:          return "Le token de connection est absent, érroné ou expiré.";                 break; +
103
                case self::PermissionError:     return "Vous n'avez pas la permission d'effectuer cette action.";              break; +
104
                case self::UploadError:         return "Une erreur d'upload est survenue.";                                   break; +
105
+
106
                // default:                        return "Erreur inconnue...";                                                  break; +
107
            }
108
-
109
    } -
110
-
111
?> +
109
            // Erreur inconnue +
110
            return null; +
111
        } +
112
+
113
    } +
114
+
115
?> @@ -247,7 +251,7 @@ Dead Code

- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 9:10:21 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 13:45:11 UTC 2016.

diff --git a/phpunit/coverage/ResourceDispatcher.php.html b/phpunit/coverage/ResourceDispatcher.php.html index 64cd4fc..286a147 100755 --- a/phpunit/coverage/ResourceDispatcher.php.html +++ b/phpunit/coverage/ResourceDispatcher.php.html @@ -229,12 +229,12 @@ - + - + @@ -280,7 +280,7 @@ - + @@ -314,7 +314,7 @@ - + @@ -371,7 +371,7 @@ - + @@ -444,14 +444,14 @@ - + - + @@ -517,7 +517,7 @@ Dead Code

- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 9:10:21 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 13:45:11 UTC 2016.

diff --git a/phpunit/coverage/autoloader.php.html b/phpunit/coverage/autoloader.php.html index 11c303d..5daa646 100755 --- a/phpunit/coverage/autoloader.php.html +++ b/phpunit/coverage/autoloader.php.html @@ -214,7 +214,7 @@ Dead Code

- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 9:10:21 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 13:45:11 UTC 2016.

diff --git a/phpunit/coverage/index.html b/phpunit/coverage/index.html index a6d40b9..2af40fd 100755 --- a/phpunit/coverage/index.html +++ b/phpunit/coverage/index.html @@ -43,13 +43,13 @@ - - + + - + - - + +
<?php 
<?php
    namespace manager;
    use \manager\Repo;
    use \manager\sessionManager;
    
    class ResourceDispatcher{
            // Dossiers supportes
            $parents_conf = json_decode( file_get_contents(__ROOT__.self::$parents_config_path), true );
            
            // Gestion de l'erreur de parsage
            if( $parents_conf == null ){
                $this->error = ManagerError::ParsingFailed;
            if( $view ) // Appel externe
                $this->view();
            
            return true;
        }
            if( !$correct )
                return false;
                
            /* [2] Creation (non serialisee) des flags
            ======================================================*/
            // Si tout se deroule bien, on cree les flags
                    $this->stylesheet .= "\t}\n";
                $this->stylesheet .= "</style>";
            }
            
            /* [5] On definit le header
            ==========================================================*/
            $this->header = $header;
            /* [6] On construit le chemin 
            /* [6] On construit le chemin
            ==========================================================*/
            $this->path = __ROOT__.$parent.'/'.$opt_subParent.$this->flags['filename'].'.'.$this->flags['extension'];
Total
-
- 64.97% covered (warning) +
+ 65.21% covered (warning)
64.97%
280 / 431
65.21%
283 / 434
47.83% covered (danger) @@ -161,7 +161,7 @@
100.00%
18 / 18
19 / 19
100.00% covered (success) @@ -183,13 +183,13 @@
ModuleRequest.php
-
- 86.81% covered (warning) +
+ 87.10% covered (warning)
86.81%
79 / 91
87.10%
81 / 93
62.50% covered (warning) @@ -350,7 +350,7 @@ High: 90% to 100%

- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 9:10:21 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 13:45:11 UTC 2016.

diff --git a/phpunit/coverage/sessionManager.php.html b/phpunit/coverage/sessionManager.php.html index 508c90f..7e2bd09 100755 --- a/phpunit/coverage/sessionManager.php.html +++ b/phpunit/coverage/sessionManager.php.html @@ -315,7 +315,7 @@ Dead Code

- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 9:10:21 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Wed Apr 20 13:45:11 UTC 2016.

diff --git a/phpunit/tests/config.php b/phpunit/tests/config.php index 5d6f383..ab1f475 100644 --- a/phpunit/tests/config.php +++ b/phpunit/tests/config.php @@ -13,8 +13,9 @@ 'dispatcher-tree' => '../config/dispatcher-tree.json', 'menu' => '../config/menu.json', 'modules' => '../config/modules.json', - 'repositories' => '../config/repositories.json', - 'views' => '../config/views.json' + 'repositories' =>'../config/repositories.json', + 'upload-auth' =>'../config/upload-auth.json', + 'views' =>'../config/views.json' ); /* [1] config/database-local.json @@ -208,7 +209,26 @@ } } - /* [6] config/views.json + /* [6] config/upload-auth.json + =========================================================*/ + public function testUploadAuth(){ + /* (1) Lecture du fichier */ + $file_content = file_get_contents( self::$config['upload-auth'] ); + $this->assertNotFalse( $file_content ); + + /* (2) Parsage en JSON */ + $json_content = json_decode( $file_content, true ); + $this->assertNotNull( $json_content ); + + /* (3) Racine des uploads */ + $this->assertTrue( isset($json_content['root']) ); + + /* (4) Liste des répertoires autorisés */ + foreach($json_content['directories'] as $dir) + $this->assertTrue( preg_match('/^[a-z0-9_-]+$/', $dir) == true ); + } + + /* [7] config/views.json =========================================================*/ public function testViews(){ /* (1) Lecture du fichier */