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-02 22:45:30 +0300
committerMaurício Meneghini Fauth <mauricio@fauth.dev>2022-08-02 22:45:30 +0300
commitc550d41d1ddece5c85dbd00cdc984ed7e953aaef (patch)
treec15b4066b7f7d05682095f75fec3e2dd337ff2cc /test
parent66970049cce943d4b63d1c03496f405235bd3b32 (diff)
Extract normalization's add new primary action
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r--test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php b/test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php
new file mode 100644
index 0000000000..d55100fc08
--- /dev/null
+++ b/test/classes/Controllers/Normalization/AddNewPrimaryControllerTest.php
@@ -0,0 +1,44 @@
+<?php
+
+declare(strict_types=1);
+
+namespace PhpMyAdmin\Tests\Controllers\Normalization;
+
+use PhpMyAdmin\ConfigStorage\Relation;
+use PhpMyAdmin\Controllers\Normalization\AddNewPrimaryController;
+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\AddNewPrimaryController
+ */
+class AddNewPrimaryControllerTest extends AbstractTestCase
+{
+ public function testDefault(): void
+ {
+ $GLOBALS['cfg']['Server']['DisableIS'] = false;
+ $GLOBALS['col_priv'] = false;
+ $GLOBALS['db'] = 'test_db';
+ $GLOBALS['table'] = 'test_table';
+
+ $dbiDummy = $this->createDbiDummy();
+
+ $dbi = $this->createDatabaseInterface($dbiDummy);
+ $GLOBALS['dbi'] = $dbi;
+ $response = new ResponseRenderer();
+ $template = new Template();
+
+ $controller = new AddNewPrimaryController(
+ $response,
+ $template,
+ new Normalization($dbi, new Relation($dbi), new Transformations(), $template)
+ );
+ $controller($this->createStub(ServerRequest::class));
+
+ $this->assertStringContainsString('<table id="table_columns"', $response->getHTMLResult());
+ }
+}