diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-08-03 03:38:55 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-08-03 03:38:55 +0300 |
commit | 28d53fe50bb5e87affd14d7b2bb241e9cf23ca66 (patch) | |
tree | 597b551fd60ee708212d515d77b8989aa8171418 /test | |
parent | a37e5681c8b1000661f710346281caf52b53c3fc (diff) |
Extract normalization's create new column action
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php b/test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php new file mode 100644 index 0000000000..2a18d763bb --- /dev/null +++ b/test/classes/Controllers/Normalization/CreateNewColumnControllerTest.php @@ -0,0 +1,45 @@ +<?php + +declare(strict_types=1); + +namespace PhpMyAdmin\Tests\Controllers\Normalization; + +use PhpMyAdmin\ConfigStorage\Relation; +use PhpMyAdmin\Controllers\Normalization\CreateNewColumnController; +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\CreateNewColumnController + */ +class CreateNewColumnControllerTest extends AbstractTestCase +{ + public function testDefault(): void + { + $GLOBALS['cfg']['Server']['DisableIS'] = false; + $GLOBALS['col_priv'] = false; + $GLOBALS['db'] = 'test_db'; + $GLOBALS['table'] = 'test_table'; + $_POST['numFields'] = 1; + + $dbiDummy = $this->createDbiDummy(); + + $dbi = $this->createDatabaseInterface($dbiDummy); + $GLOBALS['dbi'] = $dbi; + $response = new ResponseRenderer(); + $template = new Template(); + + $controller = new CreateNewColumnController( + $response, + $template, + new Normalization($dbi, new Relation($dbi), new Transformations(), $template) + ); + $controller($this->createStub(ServerRequest::class)); + + $this->assertStringContainsString('<table id="table_columns"', $response->getHTMLResult()); + } +} |