diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-29 04:52:28 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-29 04:52:28 +0300 |
commit | 6e8600f321804d23999af7f06f945ac121b56139 (patch) | |
tree | 35b0add420ac5ee3728dfd3580efc44eccbe7c2d /test | |
parent | 398bdae484ae6fdb63b7ee04db788d31c358ff40 (diff) |
Extract normalization 1NF step 2 action
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php b/test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php new file mode 100644 index 0000000000..edce909046 --- /dev/null +++ b/test/classes/Controllers/Normalization/FirstNormalForm/SecondStepControllerTest.php @@ -0,0 +1,46 @@ +<?php + +declare(strict_types=1); + +namespace PhpMyAdmin\Tests\Controllers\Normalization\FirstNormalForm; + +use PhpMyAdmin\ConfigStorage\Relation; +use PhpMyAdmin\Controllers\Normalization\FirstNormalForm\SecondStepController; +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\SecondStepController + */ +class SecondStepControllerTest extends AbstractTestCase +{ + public function testDefault(): void + { + $GLOBALS['db'] = 'test_db'; + $GLOBALS['table'] = 'test_table'; + + $dbi = $this->createDatabaseInterface(); + $GLOBALS['dbi'] = $dbi; + $response = new ResponseRenderer(); + $template = new Template(); + + $controller = new SecondStepController( + $response, + $template, + new Normalization($dbi, new Relation($dbi), new Transformations(), $template) + ); + $controller($this->createStub(ServerRequest::class)); + + $this->assertSame([ + 'legendText' => 'Step 1.2 Have a primary key', + 'headText' => 'Primary key already exists.', + 'subText' => 'Taking you to next step…', + 'hasPrimaryKey' => '1', + 'extra' => '', + ], $response->getJSONResult()); + } +} |