Replace `global` keyword with `$GLOBALS`
[phpmyadmin.git] / test / classes / Controllers / CheckRelationsControllerTest.php
blobbc3d36ff85ed6ab17ac4331c6c44a42fe24a5159
1 <?php
3 declare(strict_types=1);
5 namespace PhpMyAdmin\Tests\Controllers;
7 use PhpMyAdmin\ConfigStorage\Relation;
8 use PhpMyAdmin\Controllers\CheckRelationsController;
9 use PhpMyAdmin\Http\ServerRequest;
10 use PhpMyAdmin\Template;
11 use PhpMyAdmin\Tests\AbstractTestCase;
12 use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
14 /**
15 * @covers \PhpMyAdmin\Controllers\CheckRelationsController
17 class CheckRelationsControllerTest extends AbstractTestCase
19 public function testCheckRelationsController(): void
21 $GLOBALS['server'] = 1;
22 $GLOBALS['db'] = '';
23 $GLOBALS['table'] = '';
24 $GLOBALS['text_dir'] = 'ltr';
25 $GLOBALS['PMA_PHP_SELF'] = 'index.php';
27 $request = $this->createStub(ServerRequest::class);
28 $request->method('getParsedBodyParam')->willReturnMap([
29 ['create_pmadb', null, null],
30 ['fixall_pmadb', null, null],
31 ['fix_pmadb', null, null],
32 ]);
34 $response = new ResponseRenderer();
35 $controller = new CheckRelationsController($response, new Template(), new Relation($this->dbi));
36 $controller($request);
38 $actual = $response->getHTMLResult();
40 $this->assertStringContainsString('phpMyAdmin configuration storage', $actual);
41 $this->assertStringContainsString(
42 'Configuration of pmadb… <span class="text-danger"><strong>not OK</strong></span>',
43 $actual
45 $this->assertStringContainsString(
46 'Create</a> a database named \'phpmyadmin\' and setup the phpMyAdmin configuration storage there.',
47 $actual