phpmyadmin/tests/unit/Controllers/Normalization/SecondNormalForm/FirstStepControllerTest.php
Kamil Tekiela 8015e4de72 Move DatabaseInterface to Dbal
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2024-12-22 18:34:53 +00:00

47 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Normalization\SecondNormalForm;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Normalization\SecondNormalForm\FirstStepController;
use PhpMyAdmin\Current;
use PhpMyAdmin\Dbal\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Normalization;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Transformations;
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(FirstStepController::class)]
class FirstStepControllerTest extends AbstractTestCase
{
public function testDefault(): void
{
Current::$database = 'test_db';
Current::$table = 'test_table';
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
$response = new ResponseRenderer();
$template = new Template();
$controller = new FirstStepController(
$response,
new Normalization($dbi, new Relation($dbi), new Transformations(), $template),
);
$controller(self::createStub(ServerRequest::class));
self::assertSame([
'legendText' => 'Step 2.1 Find partial dependencies',
'headText' => 'No partial dependencies possible as the primary key ( id ) has just one column.<br>',
'subText' => '',
'extra' => '<h3>Table is already in second normal form.</h3>',
'primary_key' => 'id',
], $response->getJSONResult());
}
}