[ 'host' => 'host0', 'port' => 'port0', 'only_db' => 'only_db0', 'user' => 'user0', 'auth_type' => 'config', ], '1' => [ 'host' => 'host1', 'port' => 'port1', 'only_db' => 'only_db1', 'user' => 'user1', 'auth_type' => 'config', ], ]; //$_SESSION } /** * Test for Select::render */ #[DataProvider('renderDataProvider')] public function testRender(bool $notOnlyOptions): void { if ($notOnlyOptions) { $GLOBALS['cfg']['DisplayServersList'] = null; } $html = Select::render($notOnlyOptions); $server = $GLOBALS['cfg']['Servers']['0']; if ($notOnlyOptions) { $this->assertStringContainsString( Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabServer'], 'server', ), $html, ); $this->assertStringContainsString( __('Current server:'), $html, ); $this->assertStringContainsString( '(' . __('Servers') . ')', $html, ); } //server items $this->assertStringContainsString($server['host'], $html); $this->assertStringContainsString($server['port'], $html); $this->assertStringContainsString($server['only_db'], $html); $this->assertStringContainsString($server['user'], $html); } /** @return mixed[][] */ public static function renderDataProvider(): array { return [ 'only options' => [false], 'not only options' => [true], ]; } }