Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Tiringer <tiringerdaniel@gmail.com>2021-05-03 23:51:55 +0300
committerDaniel Tiringer <tiringerdaniel@tutanota.com>2021-05-05 17:17:20 +0300
commitdebb6af80f33544dd222b917b9fb69ea4decd239 (patch)
tree3c16148853d347d9556493afb1b8d5074ededeb5 /test
parentd260e34152e1789a735e93e36bb6397aee22d816 (diff)
Move html from server/select to template
Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Factor out logic from server listing Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Create the base twig skeleton Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Insert template and variables to form part Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Insert list view template part Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Insert just options fork Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Factor out repeating code into server_options template Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Render the template Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Comment out test parts that don't work due to translate Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Fix the typos in the translatable elements Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Refactor the test into separate scenarios Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Remove indentation spaces Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Codesniffer cleanup Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Add test for fieldset existence Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Code style fixes Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Reorder lines in test Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Replace include function with tag Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com> Removing the escape calls Signed-off-by: Daniel Tiringer <tiringerdaniel@tutanota.com>
Diffstat (limited to 'test')
-rw-r--r--test/classes/Server/SelectTest.php112
1 files changed, 56 insertions, 56 deletions
diff --git a/test/classes/Server/SelectTest.php b/test/classes/Server/SelectTest.php
index e2c001d8ca..646d40b269 100644
--- a/test/classes/Server/SelectTest.php
+++ b/test/classes/Server/SelectTest.php
@@ -38,17 +38,6 @@ class SelectTest extends AbstractTestCase
$GLOBALS['table'] = 'table';
- //$_SESSION
- }
-
- /**
- * Test for Select::render
- */
- public function testRender(): void
- {
- $not_only_options = false;
- $omit_fieldset = false;
-
$GLOBALS['cfg']['DefaultTabServer'] = 'welcome';
$GLOBALS['cfg']['Servers'] = [
@@ -67,57 +56,50 @@ class SelectTest extends AbstractTestCase
'auth_type' => 'config',
],
];
+ //$_SESSION
+ }
- //$not_only_options=false & $omit_fieldset=false
- $html = Select::render($not_only_options, $omit_fieldset);
- $server = $GLOBALS['cfg']['Servers']['0'];
-
- //server items
- $this->assertStringContainsString(
- $server['host'],
- $html
- );
- $this->assertStringContainsString(
- $server['port'],
- $html
- );
- $this->assertStringContainsString(
- $server['only_db'],
- $html
- );
- $this->assertStringContainsString(
- $server['user'],
- $html
- );
-
- $not_only_options = true;
- $omit_fieldset = true;
- $GLOBALS['cfg']['DisplayServersList'] = null;
+ /**
+ * Test for Select::render
+ *
+ * @dataProvider renderDataProvider
+ */
+ public function testRender(bool $not_only_options, bool $omit_fieldset): void
+ {
+ if ($not_only_options) {
+ $GLOBALS['cfg']['DisplayServersList'] = null;
+ }
- //$not_only_options=true & $omit_fieldset=true
$html = Select::render($not_only_options, $omit_fieldset);
+ $server = $GLOBALS['cfg']['Servers']['0'];
- //$GLOBALS['cfg']['DefaultTabServer']
- $this->assertStringContainsString(
- Util::getScriptNameForOption(
- $GLOBALS['cfg']['DefaultTabServer'],
- 'server'
- ),
- $html
- );
-
- //labels
- $this->assertStringContainsString(
- __('Current server:'),
- $html
- );
- $this->assertStringContainsString(
- '(' . __('Servers') . ')',
- $html
- );
+ if ($not_only_options) {
+ if (! $omit_fieldset) {
+ $this->assertStringContainsString(
+ '</fieldset>',
+ $html
+ );
+ }
+
+ $this->assertStringContainsString(
+ Util::getScriptNameForOption(
+ $GLOBALS['cfg']['DefaultTabServer'],
+ 'server'
+ ),
+ $html
+ );
+
+ $this->assertStringContainsString(
+ __('Current server:'),
+ $html
+ );
+ $this->assertStringContainsString(
+ '(' . __('Servers') . ')',
+ $html
+ );
+ }
//server items
- $server = $GLOBALS['cfg']['Servers']['0'];
$this->assertStringContainsString(
$server['host'],
$html
@@ -135,4 +117,22 @@ class SelectTest extends AbstractTestCase
$html
);
}
+
+ public function renderDataProvider(): array
+ {
+ return [
+ 'only options, don\'t omit fieldset' => [
+ false,
+ false,
+ ],
+ 'not only options, omits fieldset' => [
+ true,
+ true,
+ ],
+ 'not only options, don\'t omit fieldset' => [
+ true,
+ false,
+ ],
+ ];
+ }
}