Skip to content

Commit 9ebb17d

Browse files
committed
Add basic test for Table\DropColumnConfirmationController
Fixes 476a80c Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 476a80c commit 9ebb17d

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\Tests\Controllers\Table;
6+
7+
use PhpMyAdmin\Controllers\Table\DropColumnConfirmationController;
8+
use PhpMyAdmin\Template;
9+
use PhpMyAdmin\Tests\AbstractTestCase;
10+
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
11+
12+
/**
13+
* @covers \PhpMyAdmin\Controllers\Table\DropColumnConfirmationController
14+
*/
15+
class DropColumnConfirmationControllerTest extends AbstractTestCase
16+
{
17+
public function testDropColumnConfirmation(): void
18+
{
19+
$GLOBALS['db'] = 'test_db';
20+
$GLOBALS['table'] = 'test_table';
21+
$_POST = [
22+
'db' => 'test_db',
23+
'table' => 'test_table',
24+
'table_type' => 'table',
25+
'selected_fld' => ['name', 'datetimefield'],
26+
];
27+
28+
$this->dummyDbi->addSelectDb('test_db');
29+
$this->dummyDbi->addResult('SHOW TABLES LIKE \'test_table\';', [['test_table']]);
30+
31+
$response = new ResponseRenderer();
32+
$template = new Template();
33+
$expected = $template->render('table/structure/drop_confirm', [
34+
'db' => 'test_db',
35+
'table' => 'test_table',
36+
'fields' => ['name', 'datetimefield'],
37+
]);
38+
39+
(new DropColumnConfirmationController($response, $template))();
40+
$this->assertSame($expected, $response->getHTMLResult());
41+
}
42+
}

0 commit comments

Comments
 (0)