Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauricio@fauth.dev>2022-08-03 03:38:55 +0300
committerMaurício Meneghini Fauth <mauricio@fauth.dev>2022-08-03 03:38:55 +0300
commit28d53fe50bb5e87affd14d7b2bb241e9cf23ca66 (patch)
tree597b551fd60ee708212d515d77b8989aa8171418 /test
parenta37e5681c8b1000661f710346281caf52b53c3fc (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.php45
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());
+ }
+}