* Remove $GLOBALS['PMA_PHP_SELF'] Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Remove $GLOBALS['PMA_PHP_SELF'] from tests Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Moved cleanupPathInfo to Routing Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Remove parse_url from getRootPath Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Update baselines Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Remove invalid tests Surely, we never expect PATH to be backslash delimited. The code is not designed to handle this and the tests for this don't make much sense. Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Fix trailing slash in path Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> --------- Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
88 lines
1.9 KiB
PHP
88 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpMyAdmin\Tests;
|
|
|
|
use PhpMyAdmin\DatabaseInterface;
|
|
use PhpMyAdmin\Menu;
|
|
use PhpMyAdmin\Tests\Stubs\DbiDummy;
|
|
|
|
/** @covers \PhpMyAdmin\Menu */
|
|
class MenuTest extends AbstractTestCase
|
|
{
|
|
protected DatabaseInterface $dbi;
|
|
|
|
protected DbiDummy $dummyDbi;
|
|
|
|
/**
|
|
* Configures global environment.
|
|
*/
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
parent::setTheme();
|
|
|
|
$this->dummyDbi = $this->createDbiDummy();
|
|
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
|
|
$GLOBALS['dbi'] = $this->dbi;
|
|
|
|
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
|
$GLOBALS['server'] = 0;
|
|
$GLOBALS['cfg']['Server']['verbose'] = 'verbose host';
|
|
$GLOBALS['server'] = 'server';
|
|
$GLOBALS['db'] = 'pma_test';
|
|
$GLOBALS['table'] = 'table1';
|
|
}
|
|
|
|
/**
|
|
* Server menu test
|
|
*/
|
|
public function testServer(): void
|
|
{
|
|
$menu = new Menu($this->dbi, '', '');
|
|
$this->assertStringContainsString(
|
|
'floating_menubar',
|
|
$menu->getDisplay(),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Database menu test
|
|
*/
|
|
public function testDatabase(): void
|
|
{
|
|
$menu = new Menu($this->dbi, 'pma_test', '');
|
|
$this->assertStringContainsString(
|
|
'floating_menubar',
|
|
$menu->getDisplay(),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Table menu test
|
|
*/
|
|
public function testTable(): void
|
|
{
|
|
$menu = new Menu($this->dbi, 'pma_test', 'table1');
|
|
$this->assertStringContainsString(
|
|
'floating_menubar',
|
|
$menu->getDisplay(),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Table menu setTable test
|
|
*/
|
|
public function testSetTable(): void
|
|
{
|
|
$menu = new Menu($this->dbi, 'pma_test', '');
|
|
$menu->setTable('table1');
|
|
$this->assertStringContainsString(
|
|
'table1',
|
|
$menu->getDisplay(),
|
|
);
|
|
}
|
|
}
|