diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-30 02:11:56 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-30 02:11:56 +0300 |
commit | bcb02c2e0149f95e88b207b7206a6da35362a04a (patch) | |
tree | edff601705b33f393e2cc9daf41803b68dd9ac25 /test | |
parent | 08297d96b8c1dae5b9ee82c96b73f68ac3523136 (diff) |
Extract normalization 1NF step 4 action
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php b/test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php new file mode 100644 index 0000000000..a77cd1cb60 --- /dev/null +++ b/test/classes/Controllers/Normalization/FirstNormalForm/FourthStepControllerTest.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +namespace PhpMyAdmin\Tests\Controllers\Normalization\FirstNormalForm; + +use PhpMyAdmin\ConfigStorage\Relation; +use PhpMyAdmin\Controllers\Normalization\FirstNormalForm\FourthStepController; +use PhpMyAdmin\Http\ServerRequest; +use PhpMyAdmin\Normalization; +use PhpMyAdmin\Template; +use PhpMyAdmin\Tests\AbstractTestCase; +use PhpMyAdmin\Tests\Stubs\ResponseRenderer; +use PhpMyAdmin\Transformations; + +/** + * @covers \PhpMyAdmin\Controllers\Normalization\FirstNormalForm\FourthStepController + */ +class FourthStepControllerTest extends AbstractTestCase +{ + public function testDefault(): void + { + $GLOBALS['db'] = 'test_db'; + $GLOBALS['table'] = 'test_table'; + + $dbiDummy = $this->createDbiDummy(); + $dbiDummy->addSelectDb('test_db'); + + $dbi = $this->createDatabaseInterface($dbiDummy); + $GLOBALS['dbi'] = $dbi; + $response = new ResponseRenderer(); + $template = new Template(); + + $controller = new FourthStepController( + $response, + $template, + new Normalization($dbi, new Relation($dbi), new Transformations(), $template) + ); + $controller($this->createStub(ServerRequest::class)); + + // phpcs:disable Generic.Files.LineLength.TooLong + $this->assertSame([ + 'legendText' => 'Step 1.4 Remove redundant columns', + 'headText' => 'Do you have a group of columns which on combining gives an existing column? For example, if you have first_name, last_name and full_name then combining first_name and last_name gives full_name which is redundant.', + 'subText' => 'Check the columns which are redundant and click on remove. If no redundant column, click on \'No redundant column\'', + 'extra' => '<input type="checkbox" value="id">id [ int(11) ]<br><input type="checkbox" value="name">name [ varchar(20) ]<br><input type="checkbox" value="datetimefield">datetimefield [ datetime ]<br><br><input class="btn btn-secondary" type="submit" id="removeRedundant" value="Remove selected"><input class="btn btn-secondary" type="submit" value="No redundant column" onclick="goToFinish1NF();">', + ], $response->getJSONResult()); + // phpcs:enable + } +} |