Skip to content

Commit

Permalink
Remove unused Config::$defaultServer property
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Apr 30, 2023
1 parent 5b63d84 commit aa119f7
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 12 deletions.
4 changes: 0 additions & 4 deletions libraries/classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,13 @@ class Config

public bool $errorConfigFile = false;

/** @var mixed[] */
public array $defaultServer;

private bool $isHttps = false;

private Settings $config;

public function __construct()
{
$this->config = new Settings([]);
$this->defaultServer = $this->config->Servers[1]->asArray();
$config = $this->config->asArray();
$this->default = $config;
$this->settings = $config;
Expand Down
1 change: 0 additions & 1 deletion test/classes/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ public function testConstructor(): void
$config = $settings->asArray();
$this->assertIsArray($config['Servers']);
$this->assertEquals($settings, $object->getSettings());
$this->assertSame($config['Servers'][1], $object->defaultServer);
$this->assertEquals($config, $object->default);
$this->assertSame($config, $object->settings);
$this->assertSame($config, $object->baseSettings);
Expand Down
2 changes: 1 addition & 1 deletion test/classes/Controllers/Table/AddFieldControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testInvoke(): void
$GLOBALS['db'] = 'test_db';
$GLOBALS['table'] = 'test_table';
$GLOBALS['regenerate'] = null;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->defaultServer;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->getSettings()->Servers[1]->asArray();
$_POST = [
'db' => 'test_db',
'table' => 'test_table',
Expand Down
2 changes: 1 addition & 1 deletion test/classes/Controllers/Table/CreateControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testCreateController(): void
{
$GLOBALS['db'] = 'test_db';
$GLOBALS['table'] = 'new_test_table';
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->defaultServer;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->getSettings()->Servers[1]->asArray();
$_POST = ['db' => 'test_db', 'table' => 'new_test_table', 'num_fields' => '2'];

$dummyDbi = $this->createDbiDummy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testDeleteRowsController(): void
$GLOBALS['db'] = 'test_db';
$GLOBALS['table'] = 'test_table';
$GLOBALS['urlParams'] = [];
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->defaultServer;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->getSettings()->Servers[1]->asArray();
$GLOBALS['cfg']['Server']['DisableIS'] = true;
$_POST = [
'db' => 'test_db',
Expand Down
2 changes: 1 addition & 1 deletion test/classes/Controllers/Table/ExportControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testExportController(): void

$GLOBALS['db'] = 'test_db';
$GLOBALS['table'] = 'test_table';
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->defaultServer;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->getSettings()->Servers[1]->asArray();
$GLOBALS['cfg']['Server']['DisableIS'] = true;
$GLOBALS['single_table'] = '1';

Expand Down
2 changes: 1 addition & 1 deletion test/classes/Controllers/Table/ImportControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testImportController(): void
$GLOBALS['table'] = 'test_table';
$GLOBALS['text_dir'] = 'ltr';
$GLOBALS['lang'] = 'en';
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->defaultServer;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->getSettings()->Servers[1]->asArray();
$_GET['format'] = 'xml';

$dummyDbi = $this->createDbiDummy();
Expand Down
2 changes: 1 addition & 1 deletion test/classes/Controllers/Table/SqlControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testSqlController(): void
$GLOBALS['table'] = 'test_table';
$GLOBALS['lang'] = 'en';
$GLOBALS['text_dir'] = 'ltr';
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->defaultServer;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->getSettings()->Servers[1]->asArray();

$this->dummyDbi->addSelectDb('test_db');
$this->dummyDbi->addResult('SHOW TABLES LIKE \'test_table\';', [['test_table']]);
Expand Down
2 changes: 1 addition & 1 deletion test/classes/Controllers/Table/StructureControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testStructureController(): void
$GLOBALS['table'] = 'test_table';
$GLOBALS['text_dir'] = 'ltr';
$GLOBALS['lang'] = 'en';
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->defaultServer;
$GLOBALS['cfg']['Server'] = $GLOBALS['config']->getSettings()->Servers[1]->asArray();
$GLOBALS['cfg']['Server']['DisableIS'] = true;
$GLOBALS['cfg']['ShowStats'] = false;
$GLOBALS['cfg']['ShowPropertyComments'] = false;
Expand Down

0 comments on commit aa119f7

Please sign in to comment.