| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/prod1.wondermakr.com/phpmyadmin/test/classes/Navigation/Nodes/ |
Upload File : |
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Navigation\Nodes;
use PhpMyAdmin\Navigation\NodeFactory;
use PhpMyAdmin\Tests\AbstractTestCase;
/**
* @covers \PhpMyAdmin\Navigation\Nodes\NodeTable
*/
class NodeTableTest extends AbstractTestCase
{
/**
* SetUp for test cases
*/
protected function setUp(): void
{
parent::setUp();
$GLOBALS['server'] = 0;
$GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = 'search';
$GLOBALS['cfg']['NavigationTreeDefaultTabTable2'] = 'insert';
$GLOBALS['cfg']['DefaultTabTable'] = 'browse';
$GLOBALS['cfg']['MaxNavigationItems'] = 250;
$GLOBALS['cfg']['NavigationTreeEnableGrouping'] = true;
$GLOBALS['cfg']['NavigationTreeDbSeparator'] = '_';
$GLOBALS['cfg']['NavigationTreeTableSeparator'] = '__';
$GLOBALS['cfg']['NavigationTreeTableLevel'] = 1;
}
/**
* Test for __construct
*/
public function testConstructor(): void
{
$parent = NodeFactory::getInstance('NodeTable');
self::assertIsArray($parent->links);
self::assertSame([
'text' => ['route' => '/sql', 'params' => ['pos' => 0, 'db' => null, 'table' => null]],
'icon' => ['route' => '/table/search', 'params' => ['db' => null, 'table' => null]],
'second_icon' => ['route' => '/table/change', 'params' => ['db' => null, 'table' => null]],
'title' => 'Browse',
], $parent->links);
self::assertStringContainsString('table', $parent->classes);
}
/**
* Tests whether the node icon is properly set based on the icon target.
*
* @param string $target target of the icon
* @param string $imageName name of the image that should be set
*
* @dataProvider providerForTestIcon
*/
public function testIcon(string $target, string $imageName, string $imageTitle): void
{
$GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = $target;
$node = NodeFactory::getInstance('NodeTable');
self::assertSame($imageName, $node->icon['image']);
self::assertSame($imageTitle, $node->icon['title']);
}
/**
* Data provider for testIcon().
*
* @return array data for testIcon()
*/
public static function providerForTestIcon(): array
{
return [
['structure', 'b_props', 'Structure'],
['search', 'b_search', 'Search'],
['insert', 'b_insrow', 'Insert'],
['sql', 'b_sql', 'SQL'],
['browse', 'b_browse', 'Browse'],
];
}
}