Tests unitaires de tous les fichiers de configuration
This commit is contained in:
parent
8012f68f6b
commit
81fcbde794
|
@ -1,2 +1,3 @@
|
|||
.ftpconfig
|
||||
sftp-config.json
|
||||
phpunit/coverage/
|
||||
|
|
|
@ -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'
|
||||
// ));
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ APIClass.prototype = {
|
|||
xhr: [], // tableau d'objets pour les requêtes ajax
|
||||
|
||||
|
||||
|
||||
/* transaction avec le serveur (http://host/api/)
|
||||
*
|
||||
* @param pRequest<Object> l'objet passé en JSON à http://host/api/
|
||||
|
|
|
@ -499,8 +499,8 @@
|
|||
<tr class="warning"><td><div align="right"><a name="247"></a><a href="#247">247</a></div></td><td class="codeLine"><span class="default"> </span><span class="keyword">break</span><span class="keyword">;</span></td></tr>
|
||||
<tr><td><div align="right"><a name="248"></a><a href="#248">248</a></div></td><td class="codeLine"><span class="default"> </span></td></tr>
|
||||
<tr class="covered-by-large-tests popin" data-title="1 test covers line 249" data-content="<ul><li class="covered-by-large-tests">phpunit\Database_check::testArrayRecursive</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="249"></a><a href="#249">249</a></div></td><td class="codeLine"><span class="default"> </span><span class="keyword">default</span><span class="keyword">:</span></td></tr>
|
||||
<tr class="covered-by-large-tests popin" data-title="1 test covers line 250" data-content="<ul><li class="covered-by-large-tests">phpunit\Database_check::testArrayRecursive</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="250"></a><a href="#250">250</a></div></td><td class="codeLine"><span class="default"> </span><span class="keyword">return</span><span class="default"> </span><span class="default">false</span><span class="keyword">;</span></td></tr>
|
||||
<tr><td><div align="right"><a name="251"></a><a href="#251">251</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="covered-by-large-tests popin" data-title="1 test covers line 250" data-content="<ul><li class="covered-by-large-tests">phpunit\Database_check::testArrayRecursive</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="250"></a><a href="#250">250</a></div></td><td class="codeLine"><span class="default"> </span><span class="keyword">return</span><span class="default"> </span><span class="default">false</span><span class="keyword">;</span></td></tr>
|
||||
<tr class="warning"><td><div align="right"><a name="251"></a><a href="#251">251</a></div></td><td class="codeLine"><span class="default"> </span><span class="keyword">break</span><span class="keyword">;</span></td></tr>
|
||||
<tr class="covered-by-large-tests popin" data-title="1 test covers line 252" data-content="<ul><li class="covered-by-large-tests">phpunit\Database_check::testArrayRecursive</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="252"></a><a href="#252">252</a></div></td><td class="codeLine"><span class="default"> </span><span class="keyword">}</span></td></tr>
|
||||
<tr><td><div align="right"><a name="253"></a><a href="#253">253</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="warning"><td><div align="right"><a name="254"></a><a href="#254">254</a></div></td><td class="codeLine"><span class="default"> </span><span class="keyword">return</span><span class="default"> </span><span class="default">$checker</span><span class="keyword">;</span></td></tr>
|
||||
|
@ -559,7 +559,7 @@
|
|||
<span class="warning"><strong>Dead Code</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Sun Apr 17 15:49:45 UTC 2016.</small>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Mon Apr 18 6:41:06 UTC 2016.</small>
|
||||
</p>
|
||||
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
|
||||
</footer>
|
||||
|
|
|
@ -247,7 +247,7 @@
|
|||
<span class="warning"><strong>Dead Code</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Sun Apr 17 15:49:45 UTC 2016.</small>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Mon Apr 18 6:41:06 UTC 2016.</small>
|
||||
</p>
|
||||
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
|
||||
</footer>
|
||||
|
|
|
@ -517,7 +517,7 @@
|
|||
<span class="warning"><strong>Dead Code</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Sun Apr 17 15:49:45 UTC 2016.</small>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Mon Apr 18 6:41:06 UTC 2016.</small>
|
||||
</p>
|
||||
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
|
||||
</footer>
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
<span class="warning"><strong>Dead Code</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Sun Apr 17 15:49:45 UTC 2016.</small>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Mon Apr 18 6:41:06 UTC 2016.</small>
|
||||
</p>
|
||||
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
|
||||
</footer>
|
||||
|
|
|
@ -210,7 +210,7 @@
|
|||
<span class="success"><strong>High</strong>: 90% to 100%</span>
|
||||
</p>
|
||||
<p>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Sun Apr 17 15:49:45 UTC 2016.</small>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Mon Apr 18 6:41:06 UTC 2016.</small>
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
|
|
@ -315,7 +315,7 @@
|
|||
<span class="warning"><strong>Dead Code</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Sun Apr 17 15:49:45 UTC 2016.</small>
|
||||
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 2.1.7</a> using <a href="http://php.net/" target="_top">PHP 5.6.11-1ubuntu3.1</a> and <a href="http://phpunit.de/">PHPUnit 4.7.6</a> at Mon Apr 18 6:41:06 UTC 2016.</small>
|
||||
</p>
|
||||
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
|
||||
</footer>
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* [3] config/dispatcher-tree.json
|
||||
=========================================================*/
|
||||
public function testDispatcherTree(){
|
||||
|
@ -106,7 +105,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* [3] config/menu.json
|
||||
=========================================================*/
|
||||
public function testMenu(){
|
||||
|
@ -118,14 +116,115 @@
|
|||
$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) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue