From 205138fdf7fb6a9647c3186fe1d46debabb492da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 5 Sep 2017 12:12:13 +0200 Subject: [PATCH] Add tests for getting all configuration descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- test/classes/config/DescriptionTest.php | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test/classes/config/DescriptionTest.php b/test/classes/config/DescriptionTest.php index a76ef6ef2e..16252e0c9f 100644 --- a/test/classes/config/DescriptionTest.php +++ b/test/classes/config/DescriptionTest.php @@ -45,4 +45,51 @@ class DescriptionTest extends PMATestCase ), ); } + + /** + * Assertion for getting description key + * + * @return void + */ + public function assertGet($key) + { + $this->assertNotNull(Descriptions::get($key, 'name')); + $this->assertNotNull(Descriptions::get($key, 'desc')); + $this->assertNotNull(Descriptions::get($key, 'cmt')); + } + + /** + * Test getting all names for configuratons + */ + public function testAll() + { + $nested = array( + 'Export', + 'Import', + 'Schema', + 'DBG', + 'DefaultTransformations', + 'SQLQuery', + ); + + $cfg = array(); + include './libraries/config.default.php'; + foreach ($cfg as $key => $value) { + $this->assertGet($key); + if ($key == 'Servers') { + foreach ($value[1] as $item => $val) { + $this->assertGet($key . '/1/' . $item); + if ($item == 'AllowDeny') { + foreach ($val as $second => $val2) { + $this->assertGet($key . '/1/' . $item . '/' . $second); + } + } + } + } elseif (in_array($key, $nested)) { + foreach ($value as $item => $val) { + $this->assertGet($key . '/' . $item); + } + } + } + } }