Extract Config from Node classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
441e8ae1d6
commit
609ddf5c35
@ -9390,36 +9390,11 @@ parameters:
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$item of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeColumn constructor expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$key of function array_key_exists expects int\\|string, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeDatabase constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeIndex constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeTable constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeTrigger constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$name of method PhpMyAdmin\\\\Navigation\\\\Nodes\\\\Node\\:\\:getChild\\(\\) expects string, \\(int\\|string\\) given\\.$#"
|
||||
count: 1
|
||||
@ -9450,6 +9425,31 @@ parameters:
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$item of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeColumn constructor expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeDatabase constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeIndex constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeTable constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$name of class PhpMyAdmin\\\\Navigation\\\\Nodes\\\\NodeTrigger constructor expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Navigation/NavigationTree.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$path of method PhpMyAdmin\\\\Navigation\\\\NavigationTree\\:\\:buildPathPart\\(\\) expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -7057,9 +7057,6 @@
|
||||
</RiskyTruthyFalsyComparison>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeColumn.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$item['key']]]></code>
|
||||
<code><![CDATA[$item['name']]]></code>
|
||||
@ -7078,17 +7075,8 @@
|
||||
<code>$retval</code>
|
||||
</MixedOperand>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeColumnContainer.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeDatabase.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>DatabaseInterface::getInstance()</code>
|
||||
<code>DatabaseInterface::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
@ -7098,50 +7086,13 @@
|
||||
<code><![CDATA[$this->realParent()->realName]]></code>
|
||||
</PossiblyInvalidPropertyFetch>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeDatabaseChildContainer.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeDatabaseContainer.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>DatabaseInterface::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeEvent.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeFunction.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeIndex.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeIndexContainer.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeProcedure.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeTable.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>DatabaseInterface::getInstance()</code>
|
||||
<code>DatabaseInterface::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
@ -7156,21 +7107,6 @@
|
||||
<code>$secondIcon</code>
|
||||
</PossiblyUnusedProperty>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeTrigger.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeTriggerContainer.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeView.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/ObjectFetcher.php">
|
||||
<MixedReturnTypeCoercion>
|
||||
<code><![CDATA[$this->dbi->fetchResult($query)]]></code>
|
||||
@ -14273,6 +14209,7 @@
|
||||
</file>
|
||||
<file src="tests/classes/Navigation/Nodes/NodeDatabaseChildTest.php">
|
||||
<DeprecatedMethod>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>Config::getInstance()</code>
|
||||
<code>getMockForAbstractClass</code>
|
||||
</DeprecatedMethod>
|
||||
|
||||
@ -209,7 +209,7 @@ class NavigationTree
|
||||
}
|
||||
|
||||
// Initialize the tree by creating a root node
|
||||
$this->tree = new NodeDatabaseContainer('root');
|
||||
$this->tree = new NodeDatabaseContainer($this->config, 'root');
|
||||
if (
|
||||
! $this->config->settings['NavigationTreeEnableGrouping']
|
||||
|| ! $this->config->settings['ShowDatabasesNavigationAsTree']
|
||||
@ -332,7 +332,7 @@ class NavigationTree
|
||||
);
|
||||
$hiddenCounts = $this->tree->getNavigationHidingData($this->relationParameters->navigationItemsHidingFeature);
|
||||
foreach ($data as $db) {
|
||||
$node = new NodeDatabase($db);
|
||||
$node = new NodeDatabase($this->config, $db);
|
||||
if (isset($hiddenCounts[$db])) {
|
||||
$node->setHiddenCount((int) $hiddenCounts[$db]);
|
||||
}
|
||||
@ -419,11 +419,11 @@ class NavigationTree
|
||||
);
|
||||
foreach ($dbData as $item) {
|
||||
$node = match ($container->realName) {
|
||||
'events' => new NodeEvent($item),
|
||||
'functions' => new NodeFunction($item),
|
||||
'procedures' => new NodeProcedure($item),
|
||||
'tables' => new NodeTable($item),
|
||||
'views' => new NodeView($item),
|
||||
'events' => new NodeEvent($this->config, $item),
|
||||
'functions' => new NodeFunction($this->config, $item),
|
||||
'procedures' => new NodeProcedure($this->config, $item),
|
||||
'tables' => new NodeTable($this->config, $item),
|
||||
'views' => new NodeView($this->config, $item),
|
||||
default => null,
|
||||
};
|
||||
|
||||
@ -455,7 +455,7 @@ class NavigationTree
|
||||
return false;
|
||||
}
|
||||
|
||||
$node = new NodeTable($path[0]);
|
||||
$node = new NodeTable($this->config, $path[0]);
|
||||
if ($type2 === $container->realName) {
|
||||
$node->pos2 = $pos2;
|
||||
}
|
||||
@ -481,9 +481,9 @@ class NavigationTree
|
||||
$tableData = $table->getData($userPrivileges, $this->relationParameters, $container->realName, $pos3);
|
||||
foreach ($tableData as $item) {
|
||||
$node = match ($container->realName) {
|
||||
'indexes' => new NodeIndex($item),
|
||||
'columns' => new NodeColumn($item),
|
||||
'triggers' => new NodeTrigger($item),
|
||||
'indexes' => new NodeIndex($this->config, $item),
|
||||
'columns' => new NodeColumn($this->config, $item),
|
||||
'triggers' => new NodeTrigger($this->config, $item),
|
||||
default => null,
|
||||
};
|
||||
|
||||
@ -529,15 +529,15 @@ class NavigationTree
|
||||
$retval = [];
|
||||
if (! $table->hasChildren()) {
|
||||
if ($table->getPresence($userPrivileges, 'columns') !== 0) {
|
||||
$retval['columns'] = new NodeColumnContainer();
|
||||
$retval['columns'] = new NodeColumnContainer($this->config);
|
||||
}
|
||||
|
||||
if ($table->getPresence($userPrivileges, 'indexes') !== 0) {
|
||||
$retval['indexes'] = new NodeIndexContainer();
|
||||
$retval['indexes'] = new NodeIndexContainer($this->config);
|
||||
}
|
||||
|
||||
if ($table->getPresence($userPrivileges, 'triggers') !== 0) {
|
||||
$retval['triggers'] = new NodeTriggerContainer();
|
||||
$retval['triggers'] = new NodeTriggerContainer($this->config);
|
||||
}
|
||||
|
||||
// Add all new Nodes to the tree
|
||||
@ -604,23 +604,23 @@ class NavigationTree
|
||||
$retval = [];
|
||||
if (! $db->hasChildren()) {
|
||||
if (! in_array('tables', $hidden, true) && $db->getPresence($userPrivileges, 'tables')) {
|
||||
$retval['tables'] = new NodeTableContainer();
|
||||
$retval['tables'] = new NodeTableContainer($this->config);
|
||||
}
|
||||
|
||||
if (! in_array('views', $hidden, true) && $db->getPresence($userPrivileges, 'views')) {
|
||||
$retval['views'] = new NodeViewContainer();
|
||||
$retval['views'] = new NodeViewContainer($this->config);
|
||||
}
|
||||
|
||||
if (! in_array('functions', $hidden, true) && $db->getPresence($userPrivileges, 'functions')) {
|
||||
$retval['functions'] = new NodeFunctionContainer();
|
||||
$retval['functions'] = new NodeFunctionContainer($this->config);
|
||||
}
|
||||
|
||||
if (! in_array('procedures', $hidden, true) && $db->getPresence($userPrivileges, 'procedures')) {
|
||||
$retval['procedures'] = new NodeProcedureContainer();
|
||||
$retval['procedures'] = new NodeProcedureContainer($this->config);
|
||||
}
|
||||
|
||||
if (! in_array('events', $hidden, true) && $db->getPresence($userPrivileges, 'events')) {
|
||||
$retval['events'] = new NodeEventContainer();
|
||||
$retval['events'] = new NodeEventContainer($this->config);
|
||||
}
|
||||
|
||||
// Add all new Nodes to the tree
|
||||
@ -783,7 +783,7 @@ class NavigationTree
|
||||
continue;
|
||||
}
|
||||
|
||||
$newChild = new $child(mb_substr($child->name, $keySeparatorLength));
|
||||
$newChild = new $child($this->config, mb_substr($child->name, $keySeparatorLength));
|
||||
if ($child instanceof NodeDatabase && $child->getHiddenCount() > 0) {
|
||||
$newChild->setHiddenCount($child->getHiddenCount());
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ class Node
|
||||
* Only relevant if the node is of type CONTAINER
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly Config $config,
|
||||
protected readonly Config $config,
|
||||
public string $name = '',
|
||||
public readonly NodeType $type = NodeType::Object,
|
||||
public bool $isGroup = false,
|
||||
|
||||
@ -18,16 +18,12 @@ use function substr;
|
||||
*/
|
||||
class NodeColumn extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param mixed[] $item array to identify the column node
|
||||
*/
|
||||
public function __construct(array $item)
|
||||
/** @param mixed[] $item array to identify the column node */
|
||||
public function __construct(Config $config, array $item)
|
||||
{
|
||||
$this->displayName = $this->getDisplayName($item);
|
||||
|
||||
parent::__construct(Config::getInstance(), $item['name']);
|
||||
parent::__construct($config, $item['name']);
|
||||
|
||||
$this->icon = ['image' => $this->getColumnIcon($item['key']), 'title' => __('Column')];
|
||||
$this->links = [
|
||||
|
||||
@ -18,12 +18,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeColumnContainer extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), __('Columns'), NodeType::Container);
|
||||
parent::__construct($config, __('Columns'), NodeType::Container);
|
||||
|
||||
$this->icon = ['image' => 'pause', 'title' => __('Columns')];
|
||||
$this->links = [
|
||||
|
||||
@ -43,20 +43,16 @@ class NodeDatabase extends Node
|
||||
|
||||
private ObjectFetcher $objectFetcher;
|
||||
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$this->icon = ['image' => 's_db', 'title' => __('Database operations')];
|
||||
|
||||
$this->links = [
|
||||
'text' => [
|
||||
'route' => Util::getUrlForOption(Config::getInstance()->settings['DefaultTabDatabase'], 'database'),
|
||||
'route' => Util::getUrlForOption($this->config->settings['DefaultTabDatabase'], 'database'),
|
||||
'params' => ['db' => null],
|
||||
],
|
||||
'icon' => ['route' => '/database/operations', 'params' => ['db' => null]],
|
||||
@ -66,7 +62,7 @@ class NodeDatabase extends Node
|
||||
$this->classes = 'database';
|
||||
$this->urlParamName = 'db';
|
||||
|
||||
$this->objectFetcher = new ObjectFetcher(DatabaseInterface::getInstance(), Config::getInstance());
|
||||
$this->objectFetcher = new ObjectFetcher(DatabaseInterface::getInstance(), $this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,10 +115,9 @@ class NodeDatabase extends Node
|
||||
default => [],
|
||||
};
|
||||
|
||||
$config = Config::getInstance();
|
||||
$maxItems = $config->settings['MaxNavigationItems'];
|
||||
$maxItems = $this->config->settings['MaxNavigationItems'];
|
||||
|
||||
if ($config->settings['NaturalOrder']) {
|
||||
if ($this->config->settings['NaturalOrder']) {
|
||||
usort($retval, strnatcasecmp(...));
|
||||
}
|
||||
|
||||
|
||||
@ -15,22 +15,17 @@ use PhpMyAdmin\Navigation\NodeType;
|
||||
*/
|
||||
abstract class NodeDatabaseChildContainer extends NodeDatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class by setting the common variables
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name, NodeType::Container);
|
||||
parent::__construct($config, $name, NodeType::Container);
|
||||
|
||||
$config = Config::getInstance();
|
||||
if (! $config->settings['NavigationTreeEnableGrouping']) {
|
||||
if (! $this->config->settings['NavigationTreeEnableGrouping']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->separator = $config->settings['NavigationTreeTableSeparator'];
|
||||
$this->separatorDepth = $config->settings['NavigationTreeTableLevel'];
|
||||
$this->separator = $this->config->settings['NavigationTreeTableSeparator'];
|
||||
$this->separatorDepth = $this->config->settings['NavigationTreeTableLevel'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -19,19 +19,15 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeDatabaseContainer extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct($config, $name, NodeType::Container);
|
||||
|
||||
$userPrivilegesFactory = new UserPrivilegesFactory(DatabaseInterface::getInstance());
|
||||
$userPrivileges = $userPrivilegesFactory->getPrivileges();
|
||||
|
||||
parent::__construct(Config::getInstance(), $name, NodeType::Container);
|
||||
|
||||
if (! $userPrivileges->isCreateDatabase || Config::getInstance()->settings['ShowCreateDb'] === false) {
|
||||
if (! $userPrivileges->isCreateDatabase || $this->config->settings['ShowCreateDb'] === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -16,14 +16,10 @@ use function __;
|
||||
*/
|
||||
class NodeEvent extends NodeDatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$this->icon = ['image' => 'b_events', 'title' => __('Event')];
|
||||
$this->links = [
|
||||
|
||||
@ -7,6 +7,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
|
||||
use function __;
|
||||
use function _pgettext;
|
||||
|
||||
@ -15,12 +17,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeEventContainer extends NodeDatabaseChildContainer
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(__('Events'));
|
||||
parent::__construct($config, __('Events'));
|
||||
|
||||
$this->icon = ['image' => 'b_events', 'title' => __('Events')];
|
||||
$this->links = [
|
||||
|
||||
@ -16,14 +16,10 @@ use function __;
|
||||
*/
|
||||
class NodeFunction extends NodeDatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$this->icon = ['image' => 'b_routines', 'title' => __('Function')];
|
||||
$this->links = [
|
||||
|
||||
@ -7,6 +7,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
|
||||
use function __;
|
||||
use function _pgettext;
|
||||
|
||||
@ -15,12 +17,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeFunctionContainer extends NodeDatabaseChildContainer
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(__('Functions'));
|
||||
parent::__construct($config, __('Functions'));
|
||||
|
||||
$this->icon = ['image' => 'b_routines', 'title' => __('Functions')];
|
||||
$this->links = [
|
||||
|
||||
@ -16,14 +16,10 @@ use function __;
|
||||
*/
|
||||
class NodeIndex extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$this->icon = ['image' => 'b_index', 'title' => __('Index')];
|
||||
$this->links = [
|
||||
|
||||
@ -18,12 +18,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeIndexContainer extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), __('Indexes'), NodeType::Container);
|
||||
parent::__construct($config, __('Indexes'), NodeType::Container);
|
||||
|
||||
$this->icon = ['image' => 'b_index', 'title' => __('Indexes')];
|
||||
$this->links = [
|
||||
|
||||
@ -16,14 +16,10 @@ use function __;
|
||||
*/
|
||||
class NodeProcedure extends NodeDatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$this->icon = ['image' => 'b_routines', 'title' => __('Procedure')];
|
||||
$this->links = [
|
||||
|
||||
@ -7,6 +7,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
|
||||
use function __;
|
||||
use function _pgettext;
|
||||
|
||||
@ -15,12 +17,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeProcedureContainer extends NodeDatabaseChildContainer
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(__('Procedures'));
|
||||
parent::__construct($config, __('Procedures'));
|
||||
|
||||
$this->icon = ['image' => 'b_routines', 'title' => __('Procedures')];
|
||||
$this->links = [
|
||||
|
||||
@ -30,40 +30,35 @@ class NodeTable extends NodeDatabaseChild
|
||||
*/
|
||||
public array|null $secondIcon = null;
|
||||
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$config = Config::getInstance();
|
||||
$icon = $this->addIcon(
|
||||
Util::getScriptNameForOption($config->settings['NavigationTreeDefaultTabTable'], 'table'),
|
||||
Util::getScriptNameForOption($this->config->settings['NavigationTreeDefaultTabTable'], 'table'),
|
||||
);
|
||||
if ($icon !== null) {
|
||||
$this->icon = $icon;
|
||||
}
|
||||
|
||||
$this->secondIcon = $this->addIcon(
|
||||
Util::getScriptNameForOption($config->settings['NavigationTreeDefaultTabTable2'], 'table'),
|
||||
Util::getScriptNameForOption($this->config->settings['NavigationTreeDefaultTabTable2'], 'table'),
|
||||
);
|
||||
$title = (string) Util::getTitleForTarget($config->settings['DefaultTabTable']);
|
||||
$title = (string) Util::getTitleForTarget($this->config->settings['DefaultTabTable']);
|
||||
$this->title = $title;
|
||||
|
||||
$this->links = [
|
||||
'text' => [
|
||||
'route' => Util::getUrlForOption($config->settings['DefaultTabTable'], 'table'),
|
||||
'route' => Util::getUrlForOption($this->config->settings['DefaultTabTable'], 'table'),
|
||||
'params' => ['pos' => 0, 'db' => null, 'table' => null],
|
||||
],
|
||||
'icon' => [
|
||||
'route' => Util::getUrlForOption($config->settings['NavigationTreeDefaultTabTable'], 'table'),
|
||||
'route' => Util::getUrlForOption($this->config->settings['NavigationTreeDefaultTabTable'], 'table'),
|
||||
'params' => ['db' => null, 'table' => null],
|
||||
],
|
||||
'second_icon' => [
|
||||
'route' => Util::getUrlForOption($config->settings['NavigationTreeDefaultTabTable2'], 'table'),
|
||||
'route' => Util::getUrlForOption($this->config->settings['NavigationTreeDefaultTabTable2'], 'table'),
|
||||
'params' => ['db' => null, 'table' => null],
|
||||
],
|
||||
'title' => $this->title,
|
||||
@ -87,10 +82,9 @@ class NodeTable extends NodeDatabaseChild
|
||||
$db = $this->realParent()->realName;
|
||||
$table = $this->realName;
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$config = Config::getInstance();
|
||||
switch ($type) {
|
||||
case 'columns':
|
||||
if (! $config->selectedServer['DisableIS']) {
|
||||
if (! $this->config->selectedServer['DisableIS']) {
|
||||
$query = 'SELECT COUNT(*) ';
|
||||
$query .= 'FROM `INFORMATION_SCHEMA`.`COLUMNS` ';
|
||||
$query .= 'WHERE `TABLE_NAME`=' . $dbi->quoteString($table) . ' ';
|
||||
@ -111,7 +105,7 @@ class NodeTable extends NodeDatabaseChild
|
||||
$retval = (int) $dbi->queryAndGetNumRows($query);
|
||||
break;
|
||||
case 'triggers':
|
||||
if (! $config->selectedServer['DisableIS']) {
|
||||
if (! $this->config->selectedServer['DisableIS']) {
|
||||
$query = 'SELECT COUNT(*) ';
|
||||
$query .= 'FROM `INFORMATION_SCHEMA`.`TRIGGERS` ';
|
||||
$query .= 'WHERE `EVENT_OBJECT_SCHEMA` '
|
||||
@ -152,15 +146,14 @@ class NodeTable extends NodeDatabaseChild
|
||||
int $pos,
|
||||
string $searchClause = '',
|
||||
): array {
|
||||
$config = Config::getInstance();
|
||||
$maxItems = $config->settings['MaxNavigationItems'];
|
||||
$maxItems = $this->config->settings['MaxNavigationItems'];
|
||||
$retval = [];
|
||||
$db = $this->realParent()->realName;
|
||||
$table = $this->realName;
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
switch ($type) {
|
||||
case 'columns':
|
||||
if (! $config->selectedServer['DisableIS']) {
|
||||
if (! $this->config->selectedServer['DisableIS']) {
|
||||
$query = 'SELECT `COLUMN_NAME` AS `name` ';
|
||||
$query .= ',`COLUMN_KEY` AS `key` ';
|
||||
$query .= ',`DATA_TYPE` AS `type` ';
|
||||
@ -227,7 +220,7 @@ class NodeTable extends NodeDatabaseChild
|
||||
|
||||
break;
|
||||
case 'triggers':
|
||||
if (! $config->selectedServer['DisableIS']) {
|
||||
if (! $this->config->selectedServer['DisableIS']) {
|
||||
$query = 'SELECT `TRIGGER_NAME` AS `name` ';
|
||||
$query .= 'FROM `INFORMATION_SCHEMA`.`TRIGGERS` ';
|
||||
$query .= 'WHERE `EVENT_OBJECT_SCHEMA` '
|
||||
|
||||
@ -7,6 +7,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
|
||||
use function __;
|
||||
use function _pgettext;
|
||||
|
||||
@ -15,12 +17,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeTableContainer extends NodeDatabaseChildContainer
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(__('Tables'));
|
||||
parent::__construct($config, __('Tables'));
|
||||
|
||||
$this->icon = ['image' => 'b_browse', 'title' => __('Tables')];
|
||||
$this->links = [
|
||||
|
||||
@ -16,14 +16,10 @@ use function __;
|
||||
*/
|
||||
class NodeTrigger extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$this->icon = ['image' => 'b_triggers', 'title' => __('Trigger')];
|
||||
$this->links = [
|
||||
|
||||
@ -18,12 +18,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeTriggerContainer extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), __('Triggers'), NodeType::Container);
|
||||
parent::__construct($config, __('Triggers'), NodeType::Container);
|
||||
|
||||
$this->icon = ['image' => 'b_triggers', 'title' => __('Triggers')];
|
||||
$this->links = [
|
||||
|
||||
@ -16,14 +16,10 @@ use function __;
|
||||
*/
|
||||
class NodeView extends NodeDatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
/** @param string $name An identifier for the new node */
|
||||
public function __construct(Config $config, string $name)
|
||||
{
|
||||
parent::__construct(Config::getInstance(), $name);
|
||||
parent::__construct($config, $name);
|
||||
|
||||
$this->icon = ['image' => 'b_props', 'title' => __('View')];
|
||||
$this->links = [
|
||||
|
||||
@ -7,6 +7,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
|
||||
use function __;
|
||||
use function _pgettext;
|
||||
|
||||
@ -15,12 +17,9 @@ use function _pgettext;
|
||||
*/
|
||||
class NodeViewContainer extends NodeDatabaseChildContainer
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
parent::__construct(__('Views'));
|
||||
parent::__construct($config, __('Views'));
|
||||
|
||||
$this->icon = ['image' => 'b_views', 'title' => __('Views')];
|
||||
$this->links = [
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeColumnContainer;
|
||||
use PhpMyAdmin\Navigation\NodeType;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
@ -14,7 +15,7 @@ final class NodeColumnContainerTest extends AbstractTestCase
|
||||
{
|
||||
public function testColumnContainer(): void
|
||||
{
|
||||
$nodeColumnContainer = new NodeColumnContainer();
|
||||
$nodeColumnContainer = new NodeColumnContainer(new Config());
|
||||
self::assertSame('Columns', $nodeColumnContainer->name);
|
||||
self::assertSame(NodeType::Container, $nodeColumnContainer->type);
|
||||
self::assertFalse($nodeColumnContainer->isGroup);
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeColumn;
|
||||
use PhpMyAdmin\Navigation\NodeType;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
@ -14,7 +15,7 @@ final class NodeColumnTest extends AbstractTestCase
|
||||
{
|
||||
public function testColumnNode(): void
|
||||
{
|
||||
$nodeColumn = new NodeColumn([
|
||||
$nodeColumn = new NodeColumn(new Config(), [
|
||||
'name' => 'actor_id',
|
||||
'key' => 'PRI',
|
||||
'type' => 'smallint',
|
||||
@ -45,7 +46,7 @@ final class NodeColumnTest extends AbstractTestCase
|
||||
|
||||
public function testColumnNodeWithTruncatedDefaultValue(): void
|
||||
{
|
||||
$nodeColumn = new NodeColumn([
|
||||
$nodeColumn = new NodeColumn(new Config(), [
|
||||
'name' => 'last_update',
|
||||
'key' => '',
|
||||
'type' => 'timestamp',
|
||||
@ -58,7 +59,7 @@ final class NodeColumnTest extends AbstractTestCase
|
||||
|
||||
public function testColumnNodeWithTruncatedDefaultValue2(): void
|
||||
{
|
||||
$nodeColumn = new NodeColumn([
|
||||
$nodeColumn = new NodeColumn(new Config(), [
|
||||
'name' => 'email',
|
||||
'key' => 'UNI',
|
||||
'type' => 'varchar',
|
||||
@ -71,7 +72,7 @@ final class NodeColumnTest extends AbstractTestCase
|
||||
|
||||
public function testColumnNodeWithoutTruncatedDefaultValue(): void
|
||||
{
|
||||
$nodeColumn = new NodeColumn([
|
||||
$nodeColumn = new NodeColumn(new Config(), [
|
||||
'name' => 'email',
|
||||
'key' => '',
|
||||
'type' => 'varchar',
|
||||
|
||||
@ -63,7 +63,7 @@ class NodeDatabaseChildTest extends AbstractTestCase
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
]);
|
||||
|
||||
$parent = new NodeDatabase('parent');
|
||||
$parent = new NodeDatabase(Config::getInstance(), 'parent');
|
||||
$parent->addChild($this->object);
|
||||
$this->object->expects(self::once())
|
||||
->method('getItemType')
|
||||
|
||||
@ -20,7 +20,7 @@ class NodeDatabaseTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeDatabase('default');
|
||||
$parent = new NodeDatabase(new Config(), 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/database/structure', 'params' => ['db' => null]],
|
||||
@ -37,11 +37,12 @@ class NodeDatabaseTest extends AbstractTestCase
|
||||
*/
|
||||
public function testGetPresence(): void
|
||||
{
|
||||
Config::getInstance()->selectedServer['DisableIS'] = true;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = true;
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
$userPrivileges = new UserPrivileges();
|
||||
|
||||
$parent = new NodeDatabase('default');
|
||||
$parent = new NodeDatabase($config, 'default');
|
||||
self::assertEquals(
|
||||
2,
|
||||
$parent->getPresence($userPrivileges, 'tables'),
|
||||
@ -69,7 +70,8 @@ class NodeDatabaseTest extends AbstractTestCase
|
||||
*/
|
||||
public function testGetData(): void
|
||||
{
|
||||
Config::getInstance()->selectedServer['DisableIS'] = true;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = true;
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
$userPrivileges = new UserPrivileges();
|
||||
|
||||
@ -79,7 +81,7 @@ class NodeDatabaseTest extends AbstractTestCase
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
]);
|
||||
|
||||
$parent = new NodeDatabase('default');
|
||||
$parent = new NodeDatabase($config, 'default');
|
||||
|
||||
$tables = $parent->getData($userPrivileges, $relationParameters, 'tables', 0);
|
||||
self::assertContains('test1', $tables);
|
||||
@ -101,7 +103,7 @@ class NodeDatabaseTest extends AbstractTestCase
|
||||
*/
|
||||
public function testHiddenCount(): void
|
||||
{
|
||||
$parent = new NodeDatabase('default');
|
||||
$parent = new NodeDatabase(new Config(), 'default');
|
||||
$parent->setHiddenCount(1);
|
||||
self::assertSame(1, $parent->getHiddenCount());
|
||||
$parent->setHiddenCount(0);
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeEventContainer;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeEventContainerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeEventContainer();
|
||||
$parent = new NodeEventContainer(new Config());
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/database/events', 'params' => ['db' => null]],
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeEvent;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeEventTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeEvent('default');
|
||||
$parent = new NodeEvent(new Config(), 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => [
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeFunctionContainer;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeFunctionContainerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeFunctionContainer();
|
||||
$parent = new NodeFunctionContainer(new Config());
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/database/routines', 'params' => ['type' => 'FUNCTION', 'db' => null]],
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeFunction;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeFunctionTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeFunction('default');
|
||||
$parent = new NodeFunction(new Config(), 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => [
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeIndexContainer;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeIndexContainerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeIndexContainer();
|
||||
$parent = new NodeIndexContainer(new Config());
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/table/structure', 'params' => ['db' => null, 'table' => null]],
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeIndex;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeIndexTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeIndex('default');
|
||||
$parent = new NodeIndex(new Config(), 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/table/indexes', 'params' => ['db' => null, 'table' => null, 'index' => null]],
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeProcedureContainer;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeProcedureContainerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeProcedureContainer();
|
||||
$parent = new NodeProcedureContainer(new Config());
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/database/routines', 'params' => ['type' => 'PROCEDURE', 'db' => null]],
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeProcedure;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeProcedureTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeProcedure('default');
|
||||
$parent = new NodeProcedure(new Config(), 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => [
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeTableContainer;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeTableContainerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeTableContainer();
|
||||
$parent = new NodeTableContainer(new Config());
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/database/structure', 'params' => ['tbl_type' => 'table', 'db' => null]],
|
||||
|
||||
@ -22,7 +22,7 @@ class NodeTableTest extends AbstractTestCase
|
||||
$config->settings['NavigationTreeDefaultTabTable'] = 'search';
|
||||
$config->settings['NavigationTreeDefaultTabTable2'] = 'insert';
|
||||
|
||||
$parent = new NodeTable('default');
|
||||
$parent = new NodeTable($config, 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/sql', 'params' => ['pos' => 0, 'db' => null, 'table' => null]],
|
||||
@ -44,8 +44,9 @@ class NodeTableTest extends AbstractTestCase
|
||||
#[DataProvider('providerForTestIcon')]
|
||||
public function testIcon(string $target, string $imageName, string $imageTitle): void
|
||||
{
|
||||
Config::getInstance()->settings['NavigationTreeDefaultTabTable'] = $target;
|
||||
$node = new NodeTable('default');
|
||||
$config = Config::getInstance();
|
||||
$config->settings['NavigationTreeDefaultTabTable'] = $target;
|
||||
$node = new NodeTable($config, 'default');
|
||||
self::assertEquals($imageName, $node->icon['image']);
|
||||
self::assertEquals($imageTitle, $node->icon['title']);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeTriggerContainer;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeTriggerContainerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeTriggerContainer();
|
||||
$parent = new NodeTriggerContainer(new Config());
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/triggers', 'params' => ['db' => null, 'table' => null]],
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeTrigger;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeTriggerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeTrigger('default');
|
||||
$parent = new NodeTrigger(new Config(), 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => [
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeViewContainer;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeViewContainerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeViewContainer();
|
||||
$parent = new NodeViewContainer(new Config());
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/database/structure', 'params' => ['tbl_type' => 'view', 'db' => null]],
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeView;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
@ -16,7 +17,7 @@ class NodeViewTest extends AbstractTestCase
|
||||
*/
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$parent = new NodeView('default');
|
||||
$parent = new NodeView(new Config(), 'default');
|
||||
self::assertEquals(
|
||||
[
|
||||
'text' => ['route' => '/sql', 'params' => ['pos' => 0, 'db' => null, 'table' => null]],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user