diff --git a/.gitignore b/.gitignore index 3e1b44f..75cdfeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.ftpconfig sftp-config.json phpunit/coverage/ diff --git a/automate.php b/automate.php index 9a27f5a..68eb039 100755 --- a/automate.php +++ b/automate.php @@ -74,10 +74,10 @@ debug(); - + /* () Test du client de l'API generique */ // $api = new client(); - // $response = $api->send('testmethod', array( + // $response = $api->send('generate-network-chart-data', array( // '@token'=> '52945efbed43b50c12413f2f0e9519bfd9e98ce8' // )); diff --git a/config/menu.json b/config/menu.json index 13c2035..1063eef 100644 --- a/config/menu.json +++ b/config/menu.json @@ -60,4 +60,4 @@ "attributes": { "data-sublink": "users" } } ] } -] \ No newline at end of file +] diff --git a/config/modules.json b/config/modules.json index 79d8c67..6c390b0 100755 --- a/config/modules.json +++ b/config/modules.json @@ -16,7 +16,7 @@ "parameters": {} }, - + "getById": { "description": "Retourne les informations d'un utilisateur.", "permissions": ["admin"], @@ -25,14 +25,14 @@ } }, - + "getAll": { "description": "Retourne les informations de tous les utilisateurs.", "permissions": ["admin"], "parameters": {} }, - + "create": { "description": "Creation d'un nouvel utilisateur.", "permissions": ["admin"], @@ -45,7 +45,7 @@ } }, - + "remove": { "description": "Suppression d'un utilisateur.", "permissions": ["admin"], @@ -105,4 +105,4 @@ } } -} \ No newline at end of file +} diff --git a/config/repositories.json b/config/repositories.json index 8ac9f7a..1ea2122 100755 --- a/config/repositories.json +++ b/config/repositories.json @@ -23,4 +23,4 @@ "remove" ] -} \ No newline at end of file +} diff --git a/config/views.json b/config/views.json index 9cf94af..145d1ee 100644 --- a/config/views.json +++ b/config/views.json @@ -4,4 +4,4 @@ "analytics", "charts", "settings" -] \ No newline at end of file +] diff --git a/css/layout.scss b/css/layout.scss index 4a44883..27ae001 100755 --- a/css/layout.scss +++ b/css/layout.scss @@ -1,6 +1,6 @@ @import 'constants'; -body{ +body{ font-family: 'Open Sans'; font-size: 15px; @@ -23,7 +23,7 @@ body{ z-index: 1; - + /* [1] Header de la page ==========================================*/ & > #HEADER{ @@ -42,9 +42,9 @@ body{ } - + /* [2] Side-Menu de la page - ==========================================*/ + ==========================================*/ // Gestion du menu & > #MENU-SIDE{ display: block; @@ -62,7 +62,7 @@ body{ z-index: 10; } - + /* [3] Container de la page ==========================================*/ @@ -101,7 +101,7 @@ body{ &.active{ left: 0; } - + // flex properties flex-direction: row; flex-wrap: nowrap; @@ -131,7 +131,7 @@ body{ /* (2) Formulaire de connexion */ & > #login-form{ display: block; - + /* (2.1) Champs de texte (login/password) */ & > input[type='text'], @@ -149,7 +149,7 @@ body{ flex-wrap: nowrap; align-items: middle; - + border-radius: 5px; border: 1px solid lighten($theme-fg, 10); @@ -158,7 +158,7 @@ body{ color: $dark-fg-primary; font-weight: bold; letter-spacing: .07em; - + transition: border .2s ease-in-out; cursor: default; @@ -176,7 +176,7 @@ body{ & > input[type='submit']{ width: 100%; margin: 2em 0; - + border: 0; background-color: $theme-fg-primary; @@ -233,4 +233,4 @@ body{ cursor: pointer; } -} \ No newline at end of file +} diff --git a/index.php b/index.php index e67ec16..6ca0e5b 100755 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ $_POST['login'], 'password' => $_POST['password'] )); $login_ans = $login->dispatch(); - // Si aucune erreur, on dit qu'on vient de se connecter + // Si aucune erreur, on dit qu'on vient de se connecter if( $login_ans->error == ManagerError::Success ) $_SESSION['login_status'] = 'logged'; else // Si on n'a pas les bonnes donnees @@ -55,7 +55,7 @@ /* (3) Gestion de le deconnexion */ $logout_vars = isset($_POST['logout-sub']); - // Si on se deconnecte + // Si on se deconnecte if( $logout_vars ){ $logout = new ModuleRequest('user/logout'); $logout_ans = $logout->dispatch(); @@ -99,7 +99,7 @@ $R->post('api/?', function(){ $request = ModuleRequest::fromPost($_POST); $answer = $request->dispatch(); - + echo $answer->serialize(); }); @@ -107,7 +107,7 @@ // N'importe -> page d'accueil $R->get('.+', function(){ header('Location: /dashboard/'); }); $R->post('.+', function(){ header('Location: /dashboard/'); }); - + @@ -115,4 +115,4 @@ ===================================================*/ $R->run(); -?> \ No newline at end of file +?> diff --git a/js/lib/api.js b/js/lib/api.js index 7a1e279..d0fa097 100755 --- a/js/lib/api.js +++ b/js/lib/api.js @@ -5,25 +5,24 @@ APIClass.prototype = { xhr: [], // tableau d'objets pour les requêtes ajax - /* transaction avec le serveur (http://host/api/) * * @param pRequest
- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Sun Apr 17 15:49:45 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Mon Apr 18 6:41:06 UTC 2016.
diff --git a/phpunit/coverage/ManagerError.php.html b/phpunit/coverage/ManagerError.php.html index 4c46407..51d9c4c 100755 --- a/phpunit/coverage/ManagerError.php.html +++ b/phpunit/coverage/ManagerError.php.html @@ -247,7 +247,7 @@ Dead Code- Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Sun Apr 17 15:49:45 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Mon Apr 18 6:41:06 UTC 2016.
diff --git a/phpunit/coverage/ResourceDispatcher.php.html b/phpunit/coverage/ResourceDispatcher.php.html index 81c0443..0fd0aff 100755 --- a/phpunit/coverage/ResourceDispatcher.php.html +++ b/phpunit/coverage/ResourceDispatcher.php.html @@ -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 Sun Apr 17 15:49:45 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Mon Apr 18 6:41:06 UTC 2016.
diff --git a/phpunit/coverage/autoloader.php.html b/phpunit/coverage/autoloader.php.html index 5b9b035..edb67cf 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 Sun Apr 17 15:49:45 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Mon Apr 18 6:41:06 UTC 2016.
diff --git a/phpunit/coverage/index.html b/phpunit/coverage/index.html index a017ae1..0c88c4e 100755 --- a/phpunit/coverage/index.html +++ b/phpunit/coverage/index.html @@ -210,7 +210,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 Sun Apr 17 15:49:45 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Mon Apr 18 6:41:06 UTC 2016.
diff --git a/phpunit/coverage/sessionManager.php.html b/phpunit/coverage/sessionManager.php.html index 3103e3f..718c853 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 Sun Apr 17 15:49:45 UTC 2016. + Generated by PHP_CodeCoverage 2.1.7 using PHP 5.6.11-1ubuntu3.1 and PHPUnit 4.7.6 at Mon Apr 18 6:41:06 UTC 2016.
diff --git a/phpunit/tests/config.php b/phpunit/tests/config.php index 16e5c26..5d6f383 100644 --- a/phpunit/tests/config.php +++ b/phpunit/tests/config.php @@ -23,16 +23,16 @@ /* (1) Lecture du fichier */ $file_content = file_get_contents( self::$config['database-local'] ); $this->assertNotFalse( $file_content ); - + /* (2) Parsage en JSON */ $json_content = json_decode( $file_content, true ); $this->assertNotNull( $json_content ); /* (3) Contenu */ - $this->assertArrayHasKey('host', $json_content); - $this->assertArrayHasKey('dbname', $json_content); - $this->assertArrayHasKey('user', $json_content); - $this->assertArrayHasKey('password', $json_content); + $this->assertArrayHasKey('host',$json_content); + $this->assertArrayHasKey('dbname',$json_content); + $this->assertArrayHasKey('user',$json_content); + $this->assertArrayHasKey('password',$json_content); } @@ -43,7 +43,7 @@ /* (1) Lecture du fichier */ $file_content = file_get_contents( self::$config['database'] ); $this->assertNotFalse( $file_content ); - + /* (2) Parsage en JSON */ $json_content = json_decode( $file_content, true ); $this->assertNotNull( $json_content ); @@ -63,7 +63,7 @@ /* (1) Lecture du fichier */ $file_content = file_get_contents( self::$config['dispatcher-extensions'] ); $this->assertNotFalse( $file_content ); - + /* (2) Parsage en JSON */ $json_content = json_decode( $file_content, true ); $this->assertNotNull( $json_content ); @@ -81,14 +81,13 @@ } - /* [3] config/dispatcher-tree.json =========================================================*/ public function testDispatcherTree(){ /* (1) Lecture du fichier */ $file_content = file_get_contents( self::$config['dispatcher-tree'] ); $this->assertNotFalse( $file_content ); - + /* (2) Parsage en JSON */ $json_content = json_decode( $file_content, true ); $this->assertNotNull( $json_content ); @@ -106,28 +105,128 @@ } - /* [3] config/menu.json =========================================================*/ public function testMenu(){ /* (1) Lecture du fichier */ $file_content = file_get_contents( self::$config['menu'] ); $this->assertNotFalse( $file_content ); - + /* (2) Parsage en JSON */ $json_content = json_decode( $file_content, true ); $this->assertNotNull( $json_content ); - - - /* (3) Contenu */ + /* (3) Contenu de chaque catégorie */ foreach($json_content as $category){ - continue; + $this->assertArrayHasKey( 'icon', $category ); + $this->assertTrue( is_string($category['icon']) ); + $this->assertArrayHasKey( 'text', $category ); + $this->assertTrue( is_string($category['text']) ); + $this->assertArrayHasKey( 'attributes', $category ); + $this->assertTrue( is_array($category['attributes']) ); + $this->assertArrayHasKey( 'children', $category ); + $this->assertTrue( is_array($category['children']) ); + + /* (4) Contenu de chaque sous-catégorie */ + foreach($category['children'] as $children){ + $this->assertArrayHasKey( 'permissions', $children ); + $this->assertTrue( is_array($children['permissions']) ); + $this->assertArrayHasKey( 'text', $children ); + $this->assertTrue( is_string($children['text']) ); + $this->assertArrayHasKey( 'attributes', $children ); + $this->assertTrue( is_array($children['attributes']) ); + } + + } + } + + /* [4] config/modules.json + =========================================================*/ + public function testModules(){ + /* (1) Lecture du fichier */ + $file_content = file_get_contents( self::$config['modules'] ); + $this->assertNotFalse( $file_content ); + + /* (2) Parsage en JSON */ + $json_content = json_decode( $file_content, true ); + $this->assertNotNull( $json_content ); + + /* (3) Contenu de chaque module */ + foreach($json_content as $moduleName=>$methods){ + $this->assertTrue( is_string($moduleName) ); + + /* (4) Liste des méthodes du module */ + foreach($methods as $methodName=>$method){ + $this->assertTrue( is_string($methodName) ); + + $this->assertArrayHasKey( 'description', $method ); + $this->assertTrue( is_string($method['description']) ); + $this->assertArrayHasKey( 'permissions', $method ); + $this->assertTrue( is_array($method['permissions']) ); + $this->assertArrayHasKey( 'parameters', $method ); + $this->assertTrue( is_array($method['parameters']) ); + + /* (5) Pour chaque paramètre */ + foreach($method['parameters'] as $parameterName=>$parameter){ + $this->assertTrue( is_string($parameterName) ); + + $this->assertArrayHasKey( 'description', $parameter ); + $this->assertTrue( is_string($parameter['description']) ); + + $typeIsDefined = isset($parameter['type']); + + if( $typeIsDefined ) + $this->assertTrue( is_string($parameter['type']) ); + } + + } + } } + /* [5] config/repositories.json + =========================================================*/ + public function testRepositories(){ + /* (1) Lecture du fichier */ + $file_content = file_get_contents( self::$config['repositories'] ); + $this->assertNotFalse( $file_content ); + + /* (2) Parsage en JSON */ + $json_content = json_decode( $file_content, true ); + $this->assertNotNull( $json_content ); + + /* (3) Contenu de chaque repository */ + foreach($json_content as $repoName=>$methods){ + $this->assertTrue( is_string($repoName) ); + + /* (4) Liste des méthodes du repository */ + foreach($methods as $methodName) + $this->assertTrue( is_string($methodName) ); + + } + } + + /* [6] config/views.json + =========================================================*/ + public function testViews(){ + /* (1) Lecture du fichier */ + $file_content = file_get_contents( self::$config['views'] ); + $this->assertNotFalse( $file_content ); + + /* (2) Parsage en JSON */ + $json_content = json_decode( $file_content, true ); + $this->assertNotNull( $json_content ); + + /* (3) Contenu de chaque repository */ + foreach($json_content as $viewName) + $this->assertTrue( is_string($viewName) ); + } + + + + } -?> \ No newline at end of file +?> diff --git a/receiver.php b/receiver.php index 8a63dd9..34df0d1 100644 --- a/receiver.php +++ b/receiver.php @@ -1,4 +1,4 @@ \ No newline at end of file + +?> diff --git a/view.php b/view.php index a3f06ba..e1bf85e 100755 --- a/view.php +++ b/view.php @@ -35,17 +35,17 @@ - + "; - else echo "