Extract Config dependency from Template class
Uses DI instead. Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
0de5de4cba
commit
2dabc839b3
@ -1323,6 +1323,15 @@ parameters:
|
||||
count: 1
|
||||
path: src/ConfigStorage/Relation.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 4
|
||||
path: src/ConfigStorage/UserGroups.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
|
||||
@ -5448,7 +5457,7 @@ parameters:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 4
|
||||
count: 5
|
||||
path: src/Encoding.php
|
||||
|
||||
-
|
||||
@ -5481,6 +5490,15 @@ parameters:
|
||||
count: 1
|
||||
path: src/Encoding.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 1
|
||||
path: src/Engines/Innodb.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
|
||||
@ -5520,6 +5538,15 @@ parameters:
|
||||
count: 2
|
||||
path: src/Error/Error.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 1
|
||||
path: src/Error/Error.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''args'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
@ -5895,7 +5922,7 @@ parameters:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 3
|
||||
count: 4
|
||||
path: src/Favorites/RecentFavoriteTables.php
|
||||
|
||||
-
|
||||
@ -6846,7 +6873,7 @@ parameters:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 8
|
||||
count: 9
|
||||
path: src/Html/Generator.php
|
||||
|
||||
-
|
||||
@ -7572,6 +7599,15 @@ parameters:
|
||||
count: 1
|
||||
path: src/Menu.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 1
|
||||
path: src/Message.php
|
||||
|
||||
-
|
||||
message: '#^Cannot cast mixed to string\.$#'
|
||||
identifier: cast.string
|
||||
@ -8592,7 +8628,7 @@ parameters:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 6
|
||||
count: 7
|
||||
path: src/Plugins/AuthenticationPlugin.php
|
||||
|
||||
-
|
||||
@ -10593,7 +10629,7 @@ parameters:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 1
|
||||
count: 2
|
||||
path: src/Plugins/TwoFactorPlugin.php
|
||||
|
||||
-
|
||||
@ -12591,15 +12627,6 @@ parameters:
|
||||
count: 6
|
||||
path: src/Table/TableMover.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 1
|
||||
path: src/Template.php
|
||||
|
||||
-
|
||||
message: '#^Call to function in_array\(\) requires parameter \#3 to be set\.$#'
|
||||
identifier: function.strict
|
||||
@ -15882,7 +15909,7 @@ parameters:
|
||||
Use dependency injection instead\.$#
|
||||
'''
|
||||
identifier: staticMethod.deprecated
|
||||
count: 21
|
||||
count: 20
|
||||
path: tests/unit/InsertEditTest.php
|
||||
|
||||
-
|
||||
|
||||
@ -629,6 +629,10 @@
|
||||
</file>
|
||||
<file src="src/ConfigStorage/UserGroups.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
@ -3932,6 +3936,7 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<PossiblyNullArgument>
|
||||
<code><![CDATA[Config::getInstance()->getUploadTempDir()]]></code>
|
||||
@ -3942,6 +3947,7 @@
|
||||
</file>
|
||||
<file src="src/Engines/Innodb.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
@ -3955,6 +3961,9 @@
|
||||
</PossiblyUnusedMethod>
|
||||
</file>
|
||||
<file src="src/Error/Error.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$step]]></code>
|
||||
<code><![CDATA[$step['args']]]></code>
|
||||
@ -4161,6 +4170,7 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArgument>
|
||||
@ -4743,6 +4753,7 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
@ -5168,6 +5179,9 @@
|
||||
</RiskyTruthyFalsyComparison>
|
||||
</file>
|
||||
<file src="src/Message.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$this->params]]></code>
|
||||
</MixedArgument>
|
||||
@ -5783,6 +5797,7 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArrayAssignment>
|
||||
@ -7223,6 +7238,7 @@
|
||||
<file src="src/Plugins/TwoFactorPlugin.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Plugins/UploadInterface.php">
|
||||
@ -8240,11 +8256,6 @@
|
||||
<code><![CDATA[$maintainRelations]]></code>
|
||||
</UnusedVariable>
|
||||
</file>
|
||||
<file src="src/Template.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Theme/Theme.php">
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$data['name']]]></code>
|
||||
@ -10213,7 +10224,6 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
|
||||
@ -23,7 +23,7 @@ class FormDisplayTemplate
|
||||
|
||||
public function __construct(protected Config $config)
|
||||
{
|
||||
$this->template = new Template();
|
||||
$this->template = new Template($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -7,6 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Features\ConfigurableMenusFeature;
|
||||
use PhpMyAdmin\Dbal\ConnectionType;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
@ -56,7 +57,7 @@ class UserGroups
|
||||
}
|
||||
}
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
|
||||
return $template->render('server/user_groups/user_listings', [
|
||||
'user_group_special_chars' => $userGroupSpecialChars,
|
||||
@ -116,7 +117,7 @@ class UserGroups
|
||||
|
||||
$addUserUrl = Url::getFromRoute('/server/user-groups', ['addUserGroup' => 1]);
|
||||
$addUserIcon = Generator::getIcon('b_usradd');
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
|
||||
return $template->render('server/user_groups/user_groups', [
|
||||
'action' => $action,
|
||||
@ -240,7 +241,7 @@ class UserGroups
|
||||
$allowedTabs['table'],
|
||||
);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
|
||||
return $template->render('server/user_groups/edit_user_groups', [
|
||||
'user_group' => $userGroup,
|
||||
@ -272,7 +273,7 @@ class UserGroups
|
||||
$tabDetails[] = $tabDetail;
|
||||
}
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
|
||||
return $template->render('server/user_groups/tab_list', [
|
||||
'title' => $title,
|
||||
|
||||
@ -71,7 +71,7 @@ class CentralColumns
|
||||
$this->disableIs = $config->selectedServer['DisableIS'];
|
||||
|
||||
$this->relation = new Relation($this->dbi);
|
||||
$this->template = new Template();
|
||||
$this->template = new Template($config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -219,7 +219,7 @@ class Results
|
||||
) {
|
||||
$this->relation = new Relation($this->dbi);
|
||||
$this->transformations = new Transformations($this->dbi, $this->relation);
|
||||
$this->template = new Template();
|
||||
$this->template = new Template($this->config);
|
||||
|
||||
$this->setDefaultTransformations();
|
||||
|
||||
|
||||
@ -282,7 +282,7 @@ class Encoding
|
||||
*/
|
||||
public static function kanjiEncodingForm(): string
|
||||
{
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
|
||||
return $template->render('encoding/kanji_encoding_form');
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Engines;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
use PhpMyAdmin\Engines\Innodb\BufferPool;
|
||||
use PhpMyAdmin\StorageEngine;
|
||||
@ -109,7 +110,7 @@ class Innodb extends StorageEngine
|
||||
*/
|
||||
public function getPageBufferPool(): string
|
||||
{
|
||||
return (new Template())->render('server/engines/_innodb_buffer_pool', [
|
||||
return (new Template(Config::getInstance()))->render('server/engines/_innodb_buffer_pool', [
|
||||
'buffer_pool' => $this->getBufferPoolStatus(),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Error;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\MessageType;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -422,7 +423,7 @@ class Error extends Message
|
||||
{
|
||||
$this->isDisplayed(true);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
|
||||
return $template->render('error/get_display', [
|
||||
'context' => $this->getLevel() === MessageType::Error ? 'danger' : 'primary',
|
||||
|
||||
@ -89,7 +89,7 @@ class RecentFavoriteTables
|
||||
public static function getInstance(TableType $type): RecentFavoriteTables
|
||||
{
|
||||
if (! array_key_exists($type->value, self::$instances)) {
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
self::$instances[$type->value] = new RecentFavoriteTables(
|
||||
$template,
|
||||
|
||||
@ -89,7 +89,7 @@ class FileListing
|
||||
return false;
|
||||
}
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template($this->config);
|
||||
|
||||
return $template->render('file_select_options', ['filesList' => $list, 'active' => $active]);
|
||||
}
|
||||
|
||||
@ -1048,7 +1048,7 @@ class Generator
|
||||
);
|
||||
}
|
||||
|
||||
return (new Template())->render('list_navigator', [
|
||||
return (new Template(Config::getInstance()))->render('list_navigator', [
|
||||
'count' => $count,
|
||||
'max_count' => $maxCount,
|
||||
'classes' => $classes,
|
||||
|
||||
@ -636,7 +636,7 @@ class InsertEdit
|
||||
$function = $this->showTypeOrFunction('function', $urlParams, true);
|
||||
}
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template($this->config);
|
||||
|
||||
return $template->render('table/insert/get_head_and_foot_of_insert_row_table', [
|
||||
'type' => $type,
|
||||
@ -1420,7 +1420,7 @@ class InsertEdit
|
||||
*/
|
||||
public function getHtmlForInsertEditFormHeader(bool $hasBlobField, bool $isUpload): string
|
||||
{
|
||||
$template = new Template();
|
||||
$template = new Template($this->config);
|
||||
|
||||
return $template->render('table/insert/get_html_for_insert_edit_form_header', [
|
||||
'has_blob_field' => $hasBlobField,
|
||||
|
||||
@ -536,7 +536,7 @@ class Message implements Stringable
|
||||
{
|
||||
$this->isDisplayed(true);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(Config::getInstance());
|
||||
|
||||
return $template->render('message', ['context' => $this->getContext(), 'message' => $this->getMessage()]);
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ abstract class AuthenticationPlugin
|
||||
public function __construct()
|
||||
{
|
||||
$this->ipAllowDeny = new IpAllowDeny();
|
||||
$this->template = new Template();
|
||||
$this->template = new Template(Config::getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -42,7 +42,8 @@ abstract class TextImageLinkTransformationsPlugin extends TransformationsPlugin
|
||||
*/
|
||||
public function applyTransformation(string $buffer, array $options = [], FieldMetadata|null $meta = null): string
|
||||
{
|
||||
$cfg = Config::getInstance()->settings;
|
||||
$config = Config::getInstance();
|
||||
$cfg = $config->settings;
|
||||
$options = $this->getOptions($options, $cfg['DefaultTransformations']['TextImageLink']);
|
||||
$url = $options[0] . $buffer;
|
||||
/* Do not allow javascript links */
|
||||
@ -50,7 +51,7 @@ abstract class TextImageLinkTransformationsPlugin extends TransformationsPlugin
|
||||
return htmlspecialchars($url);
|
||||
}
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
return $template->render('plugins/text_image_link_transformations', [
|
||||
'url' => $url,
|
||||
|
||||
@ -43,7 +43,7 @@ class TwoFactorPlugin
|
||||
|
||||
public function __construct(protected TwoFactor $twofactor)
|
||||
{
|
||||
$this->template = new Template();
|
||||
$this->template = new Template(Config::getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -87,7 +87,7 @@ class Select
|
||||
}
|
||||
}
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
return $template->render('server/select/index', [
|
||||
'not_only_options' => $notOnlyOptions,
|
||||
|
||||
@ -1669,7 +1669,7 @@ class Sql
|
||||
{
|
||||
$indexes = Index::getFromTable($this->dbi, $table, $db);
|
||||
$indexesDuplicates = Index::findDuplicates($table, $db);
|
||||
$template = new Template();
|
||||
$template = new Template($this->config);
|
||||
|
||||
return $template->render('indexes', [
|
||||
'url_params' => UrlParams::$params,
|
||||
|
||||
@ -36,11 +36,8 @@ class Template
|
||||
|
||||
public const TEMPLATES_FOLDER = ROOT_PATH . 'resources/templates';
|
||||
|
||||
private Config $config;
|
||||
|
||||
public function __construct(Config|null $config = null)
|
||||
public function __construct(private readonly Config $config)
|
||||
{
|
||||
$this->config = $config ?? Config::getInstance();
|
||||
}
|
||||
|
||||
public static function getTwigEnvironment(string|null $cacheDir, bool $isDevEnv): Environment
|
||||
|
||||
@ -23,7 +23,8 @@ class BrowseForeignersTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->browseForeigners = new BrowseForeigners(new Template(), new Config(), new ThemeManager());
|
||||
$config = new Config();
|
||||
$this->browseForeigners = new BrowseForeigners(new Template($config), $config, new ThemeManager());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,7 +49,7 @@ class BrowseForeignersTest extends AbstractTestCase
|
||||
|
||||
$config = new Config();
|
||||
$config->set('MaxRows', 50);
|
||||
$browseForeigners = new BrowseForeigners(new Template(), $config, new ThemeManager());
|
||||
$browseForeigners = new BrowseForeigners(new Template($config), $config, new ThemeManager());
|
||||
|
||||
self::assertSame(
|
||||
'LIMIT 10, 50 ',
|
||||
@ -127,7 +128,7 @@ class BrowseForeignersTest extends AbstractTestCase
|
||||
|
||||
$config = new Config();
|
||||
$config->set('LimitChars', 5);
|
||||
$browseForeigners = new BrowseForeigners(new Template(), $config, new ThemeManager());
|
||||
$browseForeigners = new BrowseForeigners(new Template($config), $config, new ThemeManager());
|
||||
|
||||
self::assertSame(
|
||||
['fooba...', 'foobar<baz'],
|
||||
|
||||
@ -20,10 +20,11 @@ class ConsoleTest extends AbstractTestCase
|
||||
{
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($dbi, $relation);
|
||||
$history = new History($dbi, $relation, Config::getInstance());
|
||||
$console = new Console($relation, new Template(), $bookmarkRepository, $history);
|
||||
$history = new History($dbi, $relation, $config);
|
||||
$console = new Console($relation, new Template($config), $bookmarkRepository, $history);
|
||||
self::assertSame(['console.js'], $console->getScripts());
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ final class BrowseForeignersControllerTest extends AbstractTestCase
|
||||
$dbiDummy->addResult('SELECT COUNT(*) FROM .`actor`', [['3']], ['COUNT(*)']);
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
$response = (new BrowseForeignersController(
|
||||
new ResponseRenderer(),
|
||||
|
||||
@ -37,7 +37,7 @@ final class ChangeLogControllerTest extends AbstractTestCase
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'https://example.com/');
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$controller = new ChangeLogController($responseRenderer, $config, ResponseFactory::create(), $template);
|
||||
$response = $controller($request);
|
||||
|
||||
@ -57,7 +57,12 @@ final class ChangeLogControllerTest extends AbstractTestCase
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'https://example.com/');
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$controller = new ChangeLogController($responseRenderer, $config, ResponseFactory::create(), new Template());
|
||||
$controller = new ChangeLogController(
|
||||
$responseRenderer,
|
||||
$config,
|
||||
ResponseFactory::create(),
|
||||
new Template(new Config()),
|
||||
);
|
||||
$response = $controller($request);
|
||||
|
||||
self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
|
||||
|
||||
@ -25,10 +25,11 @@ class RefreshControllerTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
$response = new ResponseRenderer();
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($dbi, $relation);
|
||||
$template = new Template();
|
||||
$history = new History($dbi, $relation, Config::getInstance());
|
||||
$template = new Template($config);
|
||||
$history = new History($dbi, $relation, $config);
|
||||
$controller = new RefreshController(
|
||||
$response,
|
||||
new Console($relation, $template, $bookmarkRepository, $history),
|
||||
|
||||
@ -51,7 +51,7 @@ final class EventsControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
->withQueryParams(['db' => 'test_db']);
|
||||
@ -256,7 +256,7 @@ final class EventsControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
->withQueryParams(['db' => 'test_db']);
|
||||
|
||||
@ -78,7 +78,7 @@ final class RoutinesControllerTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
@ -314,7 +314,7 @@ final class RoutinesControllerTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests\Controllers\Database\Structure;
|
||||
|
||||
use Fig\Http\Message\StatusCodeInterface;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\Database\Structure\AddPrefixController;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Http\Factory\ResponseFactory;
|
||||
@ -25,7 +26,7 @@ final class AddPrefixControllerTest extends AbstractTestCase
|
||||
->withQueryParams(['db' => 'test_db'])
|
||||
->withParsedBody(['selected_tbl' => ['test_table']]);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$controller = new AddPrefixController(new ResponseRenderer(), ResponseFactory::create(), $template);
|
||||
$response = $controller($request);
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests\Controllers\Database\Structure;
|
||||
|
||||
use Fig\Http\Message\StatusCodeInterface;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\Database\Structure\ChangePrefixFormController;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Http\Factory\ResponseFactory;
|
||||
@ -25,7 +26,7 @@ final class ChangePrefixFormControllerTest extends AbstractTestCase
|
||||
->withQueryParams(['db' => 'test_db'])
|
||||
->withParsedBody(['selected_tbl' => ['test_table']]);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$controller = new ChangePrefixFormController(new ResponseRenderer(), ResponseFactory::create(), $template);
|
||||
$response = $controller($request);
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests\Controllers\Database\Structure;
|
||||
|
||||
use Fig\Http\Message\StatusCodeInterface;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\Database\Structure\CopyFormController;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
@ -34,7 +35,7 @@ final class CopyFormControllerTest extends AbstractTestCase
|
||||
->withQueryParams(['db' => 'test_db'])
|
||||
->withParsedBody(['selected_tbl' => ['test_table']]);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$controller = new CopyFormController(new ResponseRenderer(), ResponseFactory::create(), $template);
|
||||
$response = $controller($request);
|
||||
|
||||
|
||||
@ -40,7 +40,8 @@ class StructureControllerTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Config::getInstance()->selectedServer['DisableIS'] = false;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
Current::$table = 'table';
|
||||
Current::$database = 'db';
|
||||
|
||||
@ -61,7 +62,7 @@ class StructureControllerTest extends AbstractTestCase
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$this->template = new Template();
|
||||
$this->template = new Template($config);
|
||||
$this->response = new ResponseStub();
|
||||
$this->relation = new Relation($dbi);
|
||||
$this->replication = new Replication($dbi);
|
||||
|
||||
@ -48,7 +48,7 @@ class CreateControllerTest extends AbstractTestCase
|
||||
$config->selectedServer['user'] = 'user';
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody([
|
||||
'exportType' => 'raw',
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\GisDataEditorController;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
@ -28,7 +29,7 @@ class GisDataEditorControllerTest extends AbstractTestCase
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
|
||||
$this->controller = new GisDataEditorController(new ResponseRenderer(), new Template());
|
||||
$this->controller = new GisDataEditorController(new ResponseRenderer(), new Template(new Config()));
|
||||
}
|
||||
|
||||
#[DataProvider('providerForTestValidateGisData')]
|
||||
|
||||
@ -87,7 +87,7 @@ class ImportControllerTest extends AbstractTestCase
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$relation = new Relation($this->dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($this->dbi, $relation);
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$sql = new Sql(
|
||||
$this->dbi,
|
||||
$relation,
|
||||
|
||||
@ -32,7 +32,7 @@ class AddNewPrimaryControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$controller = new AddNewPrimaryController(
|
||||
|
||||
@ -32,7 +32,7 @@ class CreateNewColumnControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = self::createStub(ServerRequest::class);
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\FirstNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\FirstNormalForm\FirstStepController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -33,7 +34,7 @@ class FirstStepControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody(['normalizeTo' => $normalizeTo]);
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\FirstNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\FirstNormalForm\FourthStepController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -30,7 +31,7 @@ class FourthStepControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$controller = new FourthStepController(
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\FirstNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\FirstNormalForm\SecondStepController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -27,7 +28,7 @@ class SecondStepControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$controller = new SecondStepController(
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\FirstNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\FirstNormalForm\ThirdStepController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -30,7 +31,7 @@ class ThirdStepControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$controller = new ThirdStepController(
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\GetColumnsController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -30,7 +31,7 @@ class GetColumnsControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$controller = new GetColumnsController(
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\MoveRepeatingGroup;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -38,7 +39,7 @@ class MoveRepeatingGroupTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody([
|
||||
'repeatingColumns' => 'col1, col2',
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\PartialDependenciesController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -38,7 +39,7 @@ class PartialDependenciesControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$controller = new PartialDependenciesController(
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\SecondNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\SecondNormalForm\CreateNewTablesController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -35,7 +36,7 @@ class CreateNewTablesControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody([
|
||||
'pd' => json_encode(['ID, task' => [], 'task' => ['timestamp']]),
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\SecondNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\SecondNormalForm\FirstStepController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -27,7 +28,7 @@ class FirstStepControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$controller = new FirstStepController(
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\SecondNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\SecondNormalForm\NewTablesController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -29,7 +30,7 @@ class NewTablesControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody([
|
||||
'pd' => json_encode(['ID, task' => [], 'task' => ['timestamp']]),
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\ThirdNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\ThirdNormalForm\CreateNewTablesController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -52,7 +53,7 @@ class CreateNewTablesControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody(['newTables' => $newTables]);
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\ThirdNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\ThirdNormalForm\FirstStepController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -30,7 +31,7 @@ class FirstStepControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dbiDummy);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = self::createStub(ServerRequest::class);
|
||||
$request->method('getParsedBodyParam')->willReturnMap([['tables', null, ['test_table']]]);
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Normalization\ThirdNormalForm;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\Normalization\ThirdNormalForm\NewTablesController;
|
||||
use PhpMyAdmin\Current;
|
||||
@ -38,7 +39,7 @@ class NewTablesControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody([
|
||||
'tables' => $tables,
|
||||
|
||||
@ -83,7 +83,7 @@ class TableControllerTest extends AbstractTestCase
|
||||
$charsets = Charsets::getCharsets($this->dbi, false);
|
||||
$collations = Charsets::getCollations($this->dbi, false);
|
||||
|
||||
$expectedOutput = (new Template())->render('table/operations/index', [
|
||||
$expectedOutput = (new Template($config))->render('table/operations/index', [
|
||||
'db' => 'test_db',
|
||||
'table' => 'test_table',
|
||||
'url_params' => [
|
||||
|
||||
@ -71,13 +71,14 @@ class PrivilegesControllerTest extends AbstractTestCase
|
||||
$request->method('getQueryParam')->willReturnMap([['initial', null, null]]);
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$config = new Config();
|
||||
(new PrivilegesController(
|
||||
$response,
|
||||
new Template(),
|
||||
new Template($config),
|
||||
new Relation($this->dbi),
|
||||
$this->dbi,
|
||||
new UserPrivilegesFactory($this->dbi),
|
||||
new Config(),
|
||||
$config,
|
||||
))($request);
|
||||
|
||||
$this->dummyDbi->assertAllQueriesConsumed();
|
||||
@ -139,7 +140,7 @@ class PrivilegesControllerTest extends AbstractTestCase
|
||||
|
||||
$controller = new PrivilegesController(
|
||||
new ResponseRenderer(),
|
||||
new Template(),
|
||||
new Template($config),
|
||||
new Relation($dbi),
|
||||
$dbi,
|
||||
new UserPrivilegesFactory($dbi),
|
||||
|
||||
@ -36,7 +36,7 @@ class AdvisorControllerTest extends AbstractTestCase
|
||||
$config->selectedServer['host'] = 'localhost';
|
||||
|
||||
$this->response = new ResponseRenderer();
|
||||
$this->template = new Template();
|
||||
$this->template = new Template($config);
|
||||
$this->data = new Data(DatabaseInterface::getInstance(), $config);
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ class GeneralLogControllerTest extends AbstractTestCase
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$controller = new GeneralLogController(
|
||||
$response,
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->data,
|
||||
new Monitor($dbi),
|
||||
$dbi,
|
||||
|
||||
@ -57,7 +57,7 @@ class LogVarsControllerTest extends AbstractTestCase
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$controller = new LogVarsController(
|
||||
$response,
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->data,
|
||||
new Monitor($dbi),
|
||||
$dbi,
|
||||
|
||||
@ -44,7 +44,13 @@ class QueryAnalyzerControllerTest extends AbstractTestCase
|
||||
$dummyDbi->cachedAffectedRows = 123;
|
||||
|
||||
$statusData = new Data($dbi, $config);
|
||||
$controller = new QueryAnalyzerController($response, new Template(), $statusData, new Monitor($dbi), $dbi);
|
||||
$controller = new QueryAnalyzerController(
|
||||
$response,
|
||||
new Template($config),
|
||||
$statusData,
|
||||
new Monitor($dbi),
|
||||
$dbi,
|
||||
);
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
||||
->withParsedBody([
|
||||
|
||||
@ -50,7 +50,7 @@ class SlowLogControllerTest extends AbstractTestCase
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$controller = new SlowLogController(
|
||||
$response,
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->data,
|
||||
new Monitor($dbi),
|
||||
$dbi,
|
||||
|
||||
@ -50,7 +50,7 @@ class MonitorControllerTest extends AbstractTestCase
|
||||
|
||||
$controller = new MonitorController(
|
||||
$response,
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->data,
|
||||
DatabaseInterface::getInstance(),
|
||||
);
|
||||
|
||||
@ -52,13 +52,14 @@ class RefreshControllerTest extends AbstractTestCase
|
||||
'State' => 'State1',
|
||||
'Time' => 'Time1',
|
||||
];
|
||||
Config::getInstance()->settings['MaxCharactersInDisplayedSQL'] = 12;
|
||||
$config = Config::getInstance();
|
||||
$config->settings['MaxCharactersInDisplayedSQL'] = 12;
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$controller = new RefreshController(
|
||||
$response,
|
||||
new Template(),
|
||||
new Template($config),
|
||||
$this->data,
|
||||
new Processes(DatabaseInterface::getInstance()),
|
||||
);
|
||||
|
||||
@ -51,7 +51,7 @@ class ProcessesControllerTest extends AbstractTestCase
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$controller = new ProcessesController(
|
||||
$response,
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->data,
|
||||
$dbi,
|
||||
new Processes($dbi),
|
||||
|
||||
@ -80,7 +80,12 @@ class QueriesControllerTest extends AbstractTestCase
|
||||
{
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$controller = new QueriesController($response, new Template(), $this->data, DatabaseInterface::getInstance());
|
||||
$controller = new QueriesController(
|
||||
$response,
|
||||
new Template(new Config()),
|
||||
$this->data,
|
||||
DatabaseInterface::getInstance(),
|
||||
);
|
||||
|
||||
$this->dummyDbi->addSelectDb('mysql');
|
||||
$controller(self::createStub(ServerRequest::class));
|
||||
|
||||
@ -63,10 +63,11 @@ class StatusControllerTest extends AbstractTestCase
|
||||
['Com_empty_query', '0'],
|
||||
], ['Variable_name', 'Value']);
|
||||
|
||||
$data = new Data($dbi, Config::getInstance());
|
||||
$config = Config::getInstance();
|
||||
$data = new Data($dbi, $config);
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
$controller = new StatusController(
|
||||
$response,
|
||||
|
||||
@ -46,7 +46,12 @@ class VariablesControllerTest extends AbstractTestCase
|
||||
{
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$controller = new VariablesController($response, new Template(), $this->data, DatabaseInterface::getInstance());
|
||||
$controller = new VariablesController(
|
||||
$response,
|
||||
new Template(new Config()),
|
||||
$this->data,
|
||||
DatabaseInterface::getInstance(),
|
||||
);
|
||||
|
||||
$this->dummyDbi->addSelectDb('mysql');
|
||||
$controller(self::createStub(ServerRequest::class));
|
||||
|
||||
@ -76,7 +76,7 @@ class VariablesControllerTest extends AbstractTestCase
|
||||
->with('SHOW SESSION VARIABLES;')
|
||||
->willReturn($resultStub);
|
||||
|
||||
$controller = new VariablesController($response, new Template(), $this->mockedDbi);
|
||||
$controller = new VariablesController($response, new Template(new Config()), $this->mockedDbi);
|
||||
|
||||
$controller(self::createStub(ServerRequest::class));
|
||||
$html = $response->getHTMLResult();
|
||||
@ -118,7 +118,7 @@ class VariablesControllerTest extends AbstractTestCase
|
||||
{
|
||||
$controller = new VariablesController(
|
||||
ResponseRenderer::getInstance(),
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->mockedDbi,
|
||||
);
|
||||
|
||||
@ -184,7 +184,7 @@ class VariablesControllerTest extends AbstractTestCase
|
||||
|
||||
$controller = new VariablesController(
|
||||
ResponseRenderer::getInstance(),
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->mockedDbi,
|
||||
);
|
||||
|
||||
@ -237,7 +237,7 @@ class VariablesControllerTest extends AbstractTestCase
|
||||
|
||||
$controller = new VariablesController(
|
||||
ResponseRenderer::getInstance(),
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$this->mockedDbi,
|
||||
);
|
||||
|
||||
|
||||
@ -60,7 +60,8 @@ class EnumValuesControllerTest extends AbstractTestCase
|
||||
]);
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$config = Config::getInstance();
|
||||
$template = new Template($config);
|
||||
$relation = new Relation($this->dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($this->dbi, $relation);
|
||||
$sql = new Sql(
|
||||
@ -70,7 +71,7 @@ class EnumValuesControllerTest extends AbstractTestCase
|
||||
self::createStub(Transformations::class),
|
||||
$template,
|
||||
$bookmarkRepository,
|
||||
Config::getInstance(),
|
||||
$config,
|
||||
);
|
||||
|
||||
$sqlController = new EnumValuesController($responseRenderer, $template, $sql);
|
||||
@ -121,7 +122,8 @@ class EnumValuesControllerTest extends AbstractTestCase
|
||||
]);
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$config = Config::getInstance();
|
||||
$template = new Template($config);
|
||||
$relation = new Relation($this->dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($this->dbi, $relation);
|
||||
$sql = new Sql(
|
||||
@ -131,7 +133,7 @@ class EnumValuesControllerTest extends AbstractTestCase
|
||||
self::createStub(Transformations::class),
|
||||
$template,
|
||||
$bookmarkRepository,
|
||||
Config::getInstance(),
|
||||
$config,
|
||||
);
|
||||
|
||||
$sqlController = new EnumValuesController($responseRenderer, $template, $sql);
|
||||
|
||||
@ -60,7 +60,8 @@ class SetValuesControllerTest extends AbstractTestCase
|
||||
Current::$table = 'enums';
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$config = Config::getInstance();
|
||||
$template = new Template($config);
|
||||
$relation = new Relation($this->dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($this->dbi, $relation);
|
||||
$sql = new Sql(
|
||||
@ -70,7 +71,7 @@ class SetValuesControllerTest extends AbstractTestCase
|
||||
self::createStub(Transformations::class),
|
||||
$template,
|
||||
$bookmarkRepository,
|
||||
Config::getInstance(),
|
||||
$config,
|
||||
);
|
||||
|
||||
$sqlController = new SetValuesController($responseRenderer, $template, $sql);
|
||||
@ -121,7 +122,8 @@ class SetValuesControllerTest extends AbstractTestCase
|
||||
Current::$table = 'enums';
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$config = Config::getInstance();
|
||||
$template = new Template($config);
|
||||
$relation = new Relation($this->dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($this->dbi, $relation);
|
||||
$sql = new Sql(
|
||||
@ -131,7 +133,7 @@ class SetValuesControllerTest extends AbstractTestCase
|
||||
self::createStub(Transformations::class),
|
||||
$template,
|
||||
$bookmarkRepository,
|
||||
Config::getInstance(),
|
||||
$config,
|
||||
);
|
||||
|
||||
$sqlController = new SetValuesController($responseRenderer, $template, $sql);
|
||||
|
||||
@ -173,7 +173,7 @@ class AddFieldControllerTest extends AbstractTestCase
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$expected = $template->render('columns_definitions/column_definitions_form', [
|
||||
'is_backup' => false,
|
||||
'fields_meta' => null,
|
||||
@ -261,7 +261,7 @@ class AddFieldControllerTest extends AbstractTestCase
|
||||
(new AddFieldController(
|
||||
$response,
|
||||
$transformations,
|
||||
new Config(),
|
||||
$config,
|
||||
$dbi,
|
||||
new ColumnsDefinition($dbi, $relation, $transformations),
|
||||
new DbTableExists($dbi),
|
||||
|
||||
@ -76,7 +76,8 @@ class ChartControllerTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$config = new Config();
|
||||
$template = new Template($config);
|
||||
$expected = $template->render('table/chart/tbl_chart', [
|
||||
'url_params' => [
|
||||
'db' => 'test_db',
|
||||
@ -105,7 +106,7 @@ class ChartControllerTest extends AbstractTestCase
|
||||
'unlim_num_rows' => '4',
|
||||
]);
|
||||
|
||||
(new ChartController($response, $dbi, new DbTableExists($dbi), new Config()))($request);
|
||||
(new ChartController($response, $dbi, new DbTableExists($dbi), $config))($request);
|
||||
self::assertSame($expected, $response->getHTMLResult());
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ class CreateControllerTest extends AbstractTestCase
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$expected = $template->render('columns_definitions/column_definitions_form', [
|
||||
'is_backup' => false,
|
||||
'fields_meta' => null,
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\Table\DeleteConfirmController;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
@ -36,7 +37,7 @@ class DeleteConfirmControllerTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$expected = $template->render('table/delete/confirm', [
|
||||
'db' => 'test_db',
|
||||
'table' => 'test_table',
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\Table\DropColumnConfirmationController;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
@ -41,7 +42,7 @@ class DropColumnConfirmationControllerTest extends AbstractTestCase
|
||||
$response = new ResponseRenderer();
|
||||
$response->setAjax(true);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$expected = $template->render('table/structure/drop_confirm', [
|
||||
'db' => 'test_db',
|
||||
'table' => 'test_table',
|
||||
|
||||
@ -33,12 +33,13 @@ final class FindReplaceControllerTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$config = new Config();
|
||||
$controller = new FindReplaceController(
|
||||
$responseRenderer,
|
||||
new Template(),
|
||||
new Template($config),
|
||||
$dbi,
|
||||
new DbTableExists($dbi),
|
||||
new Config(),
|
||||
$config,
|
||||
);
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
@ -80,12 +81,13 @@ final class FindReplaceControllerTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$config = new Config();
|
||||
$controller = new FindReplaceController(
|
||||
$responseRenderer,
|
||||
new Template(),
|
||||
new Template($config),
|
||||
$dbi,
|
||||
new DbTableExists($dbi),
|
||||
new Config(),
|
||||
$config,
|
||||
);
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
|
||||
@ -77,7 +77,8 @@ class GisVisualizationControllerTest extends AbstractTestCase
|
||||
];
|
||||
$downloadUrl = Url::getFromRoute('/table/gis-visualization', $downloadParams + $params);
|
||||
|
||||
$template = new Template();
|
||||
$config = new Config();
|
||||
$template = new Template($config);
|
||||
$expected = $template->render('table/gis_visualization/gis_visualization', [
|
||||
'url_params' => $params,
|
||||
'download_url' => $downloadUrl,
|
||||
@ -121,7 +122,7 @@ class GisVisualizationControllerTest extends AbstractTestCase
|
||||
$dbi,
|
||||
new DbTableExists($dbi),
|
||||
ResponseFactory::create(),
|
||||
new Config(),
|
||||
$config,
|
||||
);
|
||||
$response = $controller($request);
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class IndexRenameControllerTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$expected = $template->render('table/index_rename_form', [
|
||||
'index' => new Index(['Key_name' => 'index']),
|
||||
'form_params' => ['db' => 'test_db', 'table' => 'test_table_index_rename', 'old_index' => 'index'],
|
||||
@ -60,7 +60,8 @@ class IndexRenameControllerTest extends AbstractTestCase
|
||||
$indexRegistry = new ReflectionProperty(Index::class, 'registry');
|
||||
$indexRegistry->setValue(null, []);
|
||||
|
||||
Config::getInstance()->selectedServer['DisableIS'] = true;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = true;
|
||||
|
||||
Current::$database = 'test_db';
|
||||
Current::$table = 'test_table_index_rename';
|
||||
@ -106,7 +107,7 @@ class IndexRenameControllerTest extends AbstractTestCase
|
||||
]);
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$controller = new IndexRenameController(
|
||||
$responseRenderer,
|
||||
$template,
|
||||
|
||||
@ -89,7 +89,8 @@ class IndexesControllerTest extends AbstractTestCase
|
||||
|
||||
$response = new ResponseStub();
|
||||
$index = new Index();
|
||||
$template = new Template();
|
||||
$config = Config::getInstance();
|
||||
$template = new Template($config);
|
||||
|
||||
$method = new ReflectionMethod(IndexesController::class, 'displayForm');
|
||||
|
||||
@ -99,7 +100,7 @@ class IndexesControllerTest extends AbstractTestCase
|
||||
$dbi,
|
||||
new Indexes($dbi),
|
||||
new DbTableExists($dbi),
|
||||
Config::getInstance(),
|
||||
$config,
|
||||
);
|
||||
|
||||
$_POST['create_index'] = true;
|
||||
|
||||
@ -35,7 +35,8 @@ class RelationControllerTest extends AbstractTestCase
|
||||
|
||||
Current::$database = 'db';
|
||||
Current::$table = 'table';
|
||||
Config::getInstance()->selectedServer['DisableIS'] = false;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
//$_SESSION
|
||||
|
||||
$_POST['foreignDb'] = 'db';
|
||||
@ -46,7 +47,7 @@ class RelationControllerTest extends AbstractTestCase
|
||||
->getMock();
|
||||
|
||||
$this->response = new ResponseStub();
|
||||
$this->template = new Template();
|
||||
$this->template = new Template($config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -94,14 +94,14 @@ class ReplaceControllerTest extends AbstractTestCase
|
||||
|
||||
$dummyDbi = $this->createDbiDummy();
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$transformations = new Transformations($dbi, $relation);
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$pageSettings = self::createStub(PageSettings::class);
|
||||
$bookmarkRepository = new BookmarkRepository($dbi, $relation);
|
||||
$config = Config::getInstance();
|
||||
$sqlController = new SqlController(
|
||||
$response,
|
||||
new Sql(
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Controllers\Table\Structure;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\Table\Structure\MoveColumnsController;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Message;
|
||||
@ -39,7 +40,7 @@ class MoveColumnsControllerTest extends AbstractTestCase
|
||||
|
||||
$controller = new MoveColumnsController(
|
||||
new ResponseStub(),
|
||||
new Template(),
|
||||
new Template(new Config()),
|
||||
$dbi,
|
||||
);
|
||||
/** @var string|Message $alterStatement */
|
||||
|
||||
@ -55,7 +55,7 @@ class TrackingControllerTest extends AbstractTestCase
|
||||
->withParsedBody(['version' => '', 'table' => '']);
|
||||
|
||||
$responseRenderer = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$trackingChecker = self::createStub(TrackingChecker::class);
|
||||
$relation = new Relation($this->dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($this->dbi, $relation);
|
||||
|
||||
@ -41,7 +41,7 @@ final class ZoomSearchControllerTest extends AbstractTestCase
|
||||
->withQueryParams(['db' => 'test_db', 'table' => 'test_table']);
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$controller = new ZoomSearchController(
|
||||
$response,
|
||||
$template,
|
||||
@ -91,7 +91,7 @@ final class ZoomSearchControllerTest extends AbstractTestCase
|
||||
->withParsedBody(['change_tbl_info' => '1']);
|
||||
|
||||
$response = new ResponseRenderer();
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$controller = new ZoomSearchController(
|
||||
$response,
|
||||
$template,
|
||||
|
||||
@ -27,7 +27,8 @@ final class IndexControllerTest extends AbstractTestCase
|
||||
{
|
||||
Current::$server = 2;
|
||||
Current::$database = 'test_db';
|
||||
Config::getInstance()->selectedServer['DisableIS'] = true;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = true;
|
||||
|
||||
$dummyDbi = $this->createDbiDummy();
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
@ -47,7 +48,7 @@ final class IndexControllerTest extends AbstractTestCase
|
||||
// phpcs:enable
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
@ -196,7 +197,8 @@ final class IndexControllerTest extends AbstractTestCase
|
||||
{
|
||||
Current::$server = 2;
|
||||
Current::$database = 'test_db';
|
||||
Config::getInstance()->selectedServer['DisableIS'] = true;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = true;
|
||||
|
||||
$dummyDbi = $this->createDbiDummy();
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
@ -216,7 +218,7 @@ final class IndexControllerTest extends AbstractTestCase
|
||||
// phpcs:enable
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$response = new ResponseRenderer();
|
||||
|
||||
$request = ServerRequestFactory::create()->createServerRequest('GET', 'http://example.com/')
|
||||
@ -337,7 +339,7 @@ final class IndexControllerTest extends AbstractTestCase
|
||||
|
||||
$dbi = self::createStub(DatabaseInterface::class);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$response = new ResponseRenderer();
|
||||
$indexController = new IndexController(
|
||||
$response,
|
||||
|
||||
@ -83,7 +83,8 @@ class DesignerTest extends AbstractTestCase
|
||||
$this->mockDatabaseInteraction($db);
|
||||
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template(), new Config());
|
||||
$config = new Config();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template($config), $config);
|
||||
|
||||
$method = new ReflectionMethod(Designer::class, 'getPageIdsAndNames');
|
||||
$result = $method->invokeArgs($this->designer, [$db]);
|
||||
@ -104,7 +105,8 @@ class DesignerTest extends AbstractTestCase
|
||||
$this->mockDatabaseInteraction($db);
|
||||
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template(), new Config());
|
||||
$config = new Config();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template($config), $config);
|
||||
|
||||
$result = $this->designer->getHtmlForEditOrDeletePages($db, $operation);
|
||||
self::assertStringContainsString('<input type="hidden" name="operation" value="' . $operation . '">', $result);
|
||||
@ -125,7 +127,8 @@ class DesignerTest extends AbstractTestCase
|
||||
$this->mockDatabaseInteraction($db);
|
||||
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template(), new Config());
|
||||
$config = new Config();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template($config), $config);
|
||||
|
||||
$result = $this->designer->getHtmlForPageSaveAs($db);
|
||||
self::assertStringContainsString('<input type="hidden" name="operation" value="savePage">', $result);
|
||||
@ -156,7 +159,8 @@ class DesignerTest extends AbstractTestCase
|
||||
$page = 2;
|
||||
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template(), new Config());
|
||||
$config = new Config();
|
||||
$this->designer = new Designer($dbi, new Relation($dbi), new Template($config), $config);
|
||||
|
||||
$result = $this->designer->getHtmlForSchemaExport($db, $page, null, null);
|
||||
// export type
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests\Database;
|
||||
|
||||
use PhpMyAdmin\Column;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Database\Search;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
@ -48,7 +49,7 @@ class SearchTest extends AbstractTestCase
|
||||
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$this->object = new Search($dbi, 'pma_test', new Template());
|
||||
$this->object = new Search($dbi, 'pma_test', new Template(new Config()));
|
||||
// $this->object->setSearchParams(new \PhpMyAdmin\Http\ServerRequest());
|
||||
}
|
||||
|
||||
@ -80,7 +81,7 @@ class SearchTest extends AbstractTestCase
|
||||
'criteriaSearchOptionIncludeHex' => $includeHex,
|
||||
]);
|
||||
|
||||
$this->object = new Search(DatabaseInterface::getInstance(), 'pma_test', new Template());
|
||||
$this->object = new Search(DatabaseInterface::getInstance(), 'pma_test', new Template(new Config()));
|
||||
$this->object->setSearchParams($request);
|
||||
self::assertSame(
|
||||
$expected,
|
||||
|
||||
@ -1215,7 +1215,7 @@ class ResultsTest extends AbstractTestCase
|
||||
self::assertNotFalse($dtResult);
|
||||
$actual = $object->getTable($dtResult, $displayParts, $statementInfo);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
$tableHeadersForColumns = $template->render('display/results/table_headers_for_columns', [
|
||||
'is_sortable' => true,
|
||||
@ -1507,7 +1507,7 @@ class ResultsTest extends AbstractTestCase
|
||||
self::assertNotFalse($dtResult);
|
||||
$actual = $object->getTable($dtResult, $displayParts, $statementInfo);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
|
||||
$tableHeadersForColumns = $template->render('display/results/table_headers_for_columns', [
|
||||
'is_sortable' => true,
|
||||
|
||||
@ -54,7 +54,7 @@ class ErrorReportTest extends AbstractTestCase
|
||||
$this->errorReport = new ErrorReport(
|
||||
new HttpRequest(),
|
||||
new Relation($this->dbi),
|
||||
new Template(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
$this->errorReport->setSubmissionUrl('http://localhost');
|
||||
@ -133,11 +133,12 @@ class ErrorReportTest extends AbstractTestCase
|
||||
)
|
||||
->willReturn($return);
|
||||
|
||||
$config = Config::getInstance();
|
||||
$this->errorReport = new ErrorReport(
|
||||
$httpRequest,
|
||||
new Relation($this->dbi),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
$this->errorReport->setSubmissionUrl($submissionUrl);
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class FooterTest extends AbstractTestCase
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
$config->selectedServer['verbose'] = 'verbose host';
|
||||
$_GET['reload_left_frame'] = '1';
|
||||
$this->object = new Footer(new Template(), $config);
|
||||
$this->object = new Footer(new Template($config), $config);
|
||||
Current::$sqlQuery = '';
|
||||
$_POST = [];
|
||||
}
|
||||
@ -100,7 +100,8 @@ class FooterTest extends AbstractTestCase
|
||||
*/
|
||||
public function testGetScripts(): void
|
||||
{
|
||||
$footer = new Footer(new Template(), Config::getInstance());
|
||||
$config = Config::getInstance();
|
||||
$footer = new Footer(new Template($config), $config);
|
||||
self::assertStringContainsString(
|
||||
'<script data-cfasync="false">',
|
||||
$footer->getScripts()->getDisplay(),
|
||||
@ -112,7 +113,8 @@ class FooterTest extends AbstractTestCase
|
||||
*/
|
||||
public function testDisplay(): void
|
||||
{
|
||||
$footer = new Footer(new Template(), Config::getInstance());
|
||||
$config = Config::getInstance();
|
||||
$footer = new Footer(new Template($config), $config);
|
||||
$scripts = <<<'HTML'
|
||||
|
||||
<script data-cfasync="false">
|
||||
@ -141,8 +143,9 @@ class FooterTest extends AbstractTestCase
|
||||
*/
|
||||
public function testMinimal(): void
|
||||
{
|
||||
$template = new Template();
|
||||
$footer = new Footer($template, Config::getInstance());
|
||||
$config = Config::getInstance();
|
||||
$template = new Template($config);
|
||||
$footer = new Footer($template, $config);
|
||||
$footer->setMinimal();
|
||||
$expected = [
|
||||
'is_minimal' => true,
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Html;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -18,7 +19,7 @@ class SecurityTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->template = new Template();
|
||||
$this->template = new Template(new Config());
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
||||
@ -77,7 +77,7 @@ class InsertEditTest extends AbstractTestCase
|
||||
$relation,
|
||||
new Transformations($this->dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
@ -185,14 +185,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->willReturn([], []);
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
$result = $this->callFunction(
|
||||
$this->insertEdit,
|
||||
@ -231,14 +232,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->willReturn([$meta]);
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$result = $this->callFunction(
|
||||
@ -267,14 +269,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->willReturn($resultStub);
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$result = $this->callFunction(
|
||||
@ -983,14 +986,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->getMock();
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$currentRow['f'] = '123';
|
||||
@ -1190,14 +1194,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
Current::$database = 'db';
|
||||
Current::$table = 'table';
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
$this->insertEdit->setSessionForEditNext('`a` = 2');
|
||||
|
||||
@ -1272,14 +1277,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
$_POST['submit_type'] = '';
|
||||
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
$result = $this->insertEdit->executeSqlQuery($query);
|
||||
|
||||
@ -1295,14 +1301,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
$_POST['submit_type'] = '';
|
||||
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
$result = $this->insertEdit->executeSqlQuery($query);
|
||||
|
||||
@ -1328,14 +1335,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->willReturn($warnings);
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$result = (array) $this->callFunction(
|
||||
@ -1380,14 +1388,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->willReturn('2');
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$result = $this->insertEdit->getDisplayValueForForeignTableColumn('=1', $map, 'f');
|
||||
@ -2118,14 +2127,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->willReturn(false, '123', '2013-08-28 06:34:14');
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$this->insertEdit->verifyWhetherValueCanBeTruncatedAndAppendExtraData('db', 'table', 'a', $extraData);
|
||||
@ -2167,14 +2177,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
->willReturn($columns);
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$result = $this->insertEdit->getTableColumns('db', 'table');
|
||||
@ -2218,14 +2229,15 @@ class InsertEditTest extends AbstractTestCase
|
||||
$response = new ReflectionProperty(ResponseRenderer::class, 'instance');
|
||||
$response->setValue(null, $responseMock);
|
||||
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($dbi);
|
||||
$this->insertEdit = new InsertEdit(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
$result = $this->insertEdit->determineInsertOrEdit('1', 'db', 'table');
|
||||
@ -2278,8 +2290,8 @@ class InsertEditTest extends AbstractTestCase
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new FileListing(),
|
||||
new Template(),
|
||||
Config::getInstance(),
|
||||
new Template($config),
|
||||
$config,
|
||||
);
|
||||
|
||||
self::assertSame(
|
||||
|
||||
@ -67,7 +67,8 @@ final class MenuTest extends AbstractTestCase
|
||||
{
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = new Config();
|
||||
|
||||
return new Menu($dbi, new Template(), new Config(), new Relation($dbi), $db, $table);
|
||||
return new Menu($dbi, new Template($config), $config, new Relation($dbi), $db, $table);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ class NavigationTest extends AbstractTestCase
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
$this->object = new Navigation(new Template(), new Relation($dbi), $dbi, $config);
|
||||
$this->object = new Navigation(new Template($config), new Relation($dbi), $dbi, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +77,8 @@ class NavigationTest extends AbstractTestCase
|
||||
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
|
||||
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$this->object = new Navigation(new Template(), new Relation($dbi), $dbi, Config::getInstance());
|
||||
$config = Config::getInstance();
|
||||
$this->object = new Navigation(new Template($config), new Relation($dbi), $dbi, $config);
|
||||
$this->object->hideNavigationItem('itemName', 'itemType', 'db');
|
||||
}
|
||||
|
||||
@ -99,7 +100,8 @@ class NavigationTest extends AbstractTestCase
|
||||
$dbi->expects(self::any())->method('quoteString')
|
||||
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$this->object = new Navigation(new Template(), new Relation($dbi), $dbi, Config::getInstance());
|
||||
$config = Config::getInstance();
|
||||
$this->object = new Navigation(new Template($config), new Relation($dbi), $dbi, $config);
|
||||
$this->object->unhideNavigationItem('itemName', 'itemType', 'db');
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ class NavigationTreeTest extends AbstractTestCase
|
||||
Current::$database = 'db';
|
||||
Current::$table = '';
|
||||
|
||||
$this->object = new NavigationTree(new Template(), $dbi, new Relation($dbi), $config);
|
||||
$this->object = new NavigationTree(new Template($config), $dbi, new Relation($dbi), $config);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ class NavigationTreeTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$object = new NavigationTree(new Template(), $dbi, new Relation($dbi), $config);
|
||||
$object = new NavigationTree(new Template($config), $dbi, new Relation($dbi), $config);
|
||||
$result = $object->renderState(new UserPrivileges());
|
||||
self::assertStringContainsString('<li class="first navGroup">', $result);
|
||||
self::assertStringContainsString('functions' . "\n", $result);
|
||||
|
||||
@ -96,7 +96,12 @@ class NormalizationTest extends AbstractTestCase
|
||||
->willReturn(['`id`_cnt' => 0, '`col1`_cnt' => 0, '`col2`_cnt' => 0]);
|
||||
|
||||
$relation = new Relation($dbi);
|
||||
$this->normalization = new Normalization($dbi, $relation, new Transformations($dbi, $relation), new Template());
|
||||
$this->normalization = new Normalization(
|
||||
$dbi,
|
||||
$relation,
|
||||
new Transformations($dbi, $relation),
|
||||
new Template($config),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +138,7 @@ class NormalizationTest extends AbstractTestCase
|
||||
$this->dbi,
|
||||
$relation,
|
||||
new Transformations($this->dbi, $relation),
|
||||
new Template(),
|
||||
new Template($config),
|
||||
);
|
||||
$result = $normalization->getHtmlForCreateNewColumn($userPrivileges, $numFields, $db, $table);
|
||||
self::assertStringContainsString('<table id="table_columns"', $result);
|
||||
|
||||
@ -48,7 +48,10 @@ class ReplicationGuiTest extends AbstractTestCase
|
||||
Current::$table = 'table';
|
||||
UrlParams::$params = [];
|
||||
|
||||
$this->replicationGui = new ReplicationGui(new Replication(DatabaseInterface::getInstance()), new Template());
|
||||
$this->replicationGui = new ReplicationGui(
|
||||
new Replication(DatabaseInterface::getInstance()),
|
||||
new Template($config),
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetHtmlForPrimaryReplication(): void
|
||||
|
||||
@ -127,7 +127,7 @@ final class RoutingTest extends AbstractTestCase
|
||||
|
||||
public function testCallSetupControllerWithInvalidRoute(): void
|
||||
{
|
||||
$template = new Template();
|
||||
$template = new Template(new Config());
|
||||
$container = self::createStub(ContainerInterface::class);
|
||||
$container->method('get')->willReturn($template);
|
||||
ContainerBuilder::$container = $container;
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Scripts;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Version;
|
||||
@ -25,7 +26,7 @@ class ScriptsTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = new Scripts(new Template());
|
||||
$this->object = new Scripts(new Template(new Config()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1916,14 +1916,15 @@ class PrivilegesTest extends AbstractTestCase
|
||||
['Host' => 'test.host', 'User' => 'test.user', 'Priv' => '{"account_locked":true}'],
|
||||
);
|
||||
|
||||
$config = new Config();
|
||||
$relation = new Relation($this->dbi);
|
||||
$serverPrivileges = new Privileges(
|
||||
new Template(),
|
||||
new Template($config),
|
||||
$dbi,
|
||||
$relation,
|
||||
new RelationCleanup($this->dbi, $relation),
|
||||
new Plugins($this->dbi),
|
||||
new Config(),
|
||||
$config,
|
||||
);
|
||||
$method = new ReflectionMethod(Privileges::class, 'getUserPrivileges');
|
||||
|
||||
@ -1935,15 +1936,16 @@ class PrivilegesTest extends AbstractTestCase
|
||||
|
||||
private function getPrivileges(DatabaseInterface $dbi): Privileges
|
||||
{
|
||||
$config = new Config();
|
||||
$relation = new Relation($dbi);
|
||||
|
||||
return new Privileges(
|
||||
new Template(),
|
||||
new Template($config),
|
||||
$dbi,
|
||||
$relation,
|
||||
new RelationCleanup($dbi, $relation),
|
||||
new Plugins($dbi),
|
||||
new Config(),
|
||||
$config,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -54,14 +54,14 @@ class SqlQueryFormTest extends AbstractTestCase
|
||||
);
|
||||
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
|
||||
DatabaseInterface::$instance = $this->dbi;
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($this->dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($this->dbi, $relation);
|
||||
$this->sqlQueryForm = new SqlQueryForm(new Template(), $this->dbi, $bookmarkRepository);
|
||||
$this->sqlQueryForm = new SqlQueryForm(new Template($config), $this->dbi, $bookmarkRepository);
|
||||
|
||||
Current::$database = 'PMA_db';
|
||||
Current::$table = 'PMA_table';
|
||||
|
||||
$config = Config::getInstance();
|
||||
$config->settings['TextareaAutoSelect'] = true;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
|
||||
@ -51,15 +51,16 @@ class SqlTest extends AbstractTestCase
|
||||
Current::$database = 'db';
|
||||
Current::$table = 'table';
|
||||
|
||||
$config = Config::getInstance();
|
||||
$relation = new Relation($this->dbi);
|
||||
$this->sql = new Sql(
|
||||
$this->dbi,
|
||||
$relation,
|
||||
new RelationCleanup($this->dbi, $relation),
|
||||
new Transformations($this->dbi, $relation),
|
||||
new Template(),
|
||||
new Template($config),
|
||||
new BookmarkRepository($this->dbi, $relation),
|
||||
Config::getInstance(),
|
||||
$config,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class TemplateTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->template = new Template();
|
||||
$this->template = new Template(new Config());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,13 +126,14 @@ class TemplateTest extends AbstractTestCase
|
||||
|
||||
public function testLoadingTwigEnvOnlyOnce(): void
|
||||
{
|
||||
$config = new Config();
|
||||
$twigEnvCacheProperty = new ReflectionProperty(Template::class, 'twig');
|
||||
$twigEnvCacheProperty->setValue(null, null);
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
self::assertSame("static content\n", $template->render('test/static'));
|
||||
$twigEnv = $twigEnvCacheProperty->getValue();
|
||||
self::assertInstanceOf(Environment::class, $twigEnv);
|
||||
$template2 = new Template();
|
||||
$template2 = new Template($config);
|
||||
self::assertSame("static content\n", $template2->render('test/static'));
|
||||
self::assertSame($twigEnv, $twigEnvCacheProperty->getValue());
|
||||
}
|
||||
@ -140,7 +141,7 @@ class TemplateTest extends AbstractTestCase
|
||||
public function testDisableCache(): void
|
||||
{
|
||||
(new ReflectionProperty(Template::class, 'twig'))->setValue(null, null);
|
||||
$template = new Template(self::createStub(Config::class));
|
||||
$template = new Template(new Config());
|
||||
$template->disableCache();
|
||||
$twig = (new ReflectionProperty(Template::class, 'twig'))->getValue();
|
||||
self::assertInstanceOf(Environment::class, $twig);
|
||||
|
||||
@ -65,7 +65,7 @@ final class TrackingTest extends AbstractTestCase
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
$template = new Template();
|
||||
$template = new Template($config);
|
||||
$relation = new Relation($dbi);
|
||||
$bookmarkRepository = new BookmarkRepository($dbi, $relation);
|
||||
$this->tracking = new Tracking(
|
||||
|
||||
@ -20,7 +20,7 @@ final class UrlRedirectorTest extends AbstractTestCase
|
||||
$config = Config::getInstance();
|
||||
$config->set('PmaAbsoluteUri', 'http://localhost/phpmyadmin');
|
||||
|
||||
$urlRedirector = new UrlRedirector(new ResponseRenderer(), new Template(), ResponseFactory::create());
|
||||
$urlRedirector = new UrlRedirector(new ResponseRenderer(), new Template($config), ResponseFactory::create());
|
||||
|
||||
$response = $urlRedirector->redirect('https://user:pass@example.com/');
|
||||
self::assertSame('/phpmyadmin/', $response->getHeaderLine('Location'));
|
||||
@ -31,7 +31,11 @@ final class UrlRedirectorTest extends AbstractTestCase
|
||||
{
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
|
||||
$urlRedirector = new UrlRedirector(new ResponseRenderer(), new Template(), ResponseFactory::create());
|
||||
$urlRedirector = new UrlRedirector(
|
||||
new ResponseRenderer(),
|
||||
new Template(new Config()),
|
||||
ResponseFactory::create(),
|
||||
);
|
||||
|
||||
$response = $urlRedirector->redirect('https://phpmyadmin.net/');
|
||||
$expected = <<<'HTML'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user