phpmyadmin/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php
Maurício Meneghini Fauth 1438cb211e
Replace global keyword with $GLOBALS
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-07 17:31:11 -03:00

53 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Database\MultiTableQuery;
use PhpMyAdmin\Controllers\Database\MultiTableQuery\TablesController;
use PhpMyAdmin\Tests\AbstractTestCase;
/**
* @covers \PhpMyAdmin\Controllers\Database\MultiTableQuery\TablesController
*/
class TablesControllerTest extends AbstractTestCase
{
protected function setUp(): void
{
parent::setUp();
parent::setLanguage();
parent::setGlobalDbi();
parent::loadContainerBuilder();
parent::loadDbiIntoContainerBuilder();
$GLOBALS['server'] = 1;
$GLOBALS['PMA_PHP_SELF'] = '';
parent::loadResponseIntoContainerBuilder();
}
public function testGetForeignKeyConstrainsForTable(): void
{
$_GET['tables'] = [
'table1',
'table2',
];
$_GET['db'] = 'test';
/** @var TablesController $multiTableQueryController */
$multiTableQueryController = $GLOBALS['containerBuilder']->get(TablesController::class);
$multiTableQueryController();
$this->assertSame(
[
'foreignKeyConstrains' => [
[
'TABLE_NAME' => 'table2',
'COLUMN_NAME' => 'idtable2',
'REFERENCED_TABLE_NAME' => 'table1',
'REFERENCED_COLUMN_NAME' => 'idtable1',
],
],
],
$this->getResponseJsonResult()
);
}
}