Skip to content

Commit 346923e

Browse files
committed
Set dbi only when the test needs it
Related to #17637 Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 615782a commit 346923e

109 files changed

Lines changed: 188 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/classes/AbstractTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ protected function setUp(): void
8383
// Config before DBI
8484
$this->setGlobalConfig();
8585
$this->loadContainerBuilder();
86-
$GLOBALS['dbi'] = $this->createDatabaseInterface();
8786
$this->setTheme();
8887
Cache::purge();
8988
}

test/classes/Advisory/AdvisorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ protected function setUp(): void
1717
{
1818
parent::setUp();
1919
parent::setGlobalConfig();
20+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
2021
$GLOBALS['server'] = 1;
2122
}
2223

test/classes/CheckUserPrivilegesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class CheckUserPrivilegesTest extends AbstractTestCase
2020
protected function setUp(): void
2121
{
2222
parent::setUp();
23+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
2324
$GLOBALS['server'] = 1;
2425
$GLOBALS['cfg']['Server']['DisableIS'] = false;
2526
$GLOBALS['col_priv'] = false;

test/classes/Config/PageSettingsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ protected function setUp(): void
2121
parent::setLanguage();
2222
parent::setGlobalConfig();
2323
parent::setTheme();
24+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
2425
$GLOBALS['server'] = 1;
2526
$GLOBALS['db'] = 'db';
2627
$GLOBALS['table'] = '';

test/classes/ConfigStorage/UserGroupsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class UserGroupsTest extends AbstractTestCase
3030
protected function setUp(): void
3131
{
3232
parent::setUp();
33+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
3334
$GLOBALS['db'] = '';
3435
$GLOBALS['table'] = '';
3536

test/classes/ConfigTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected function setUp(): void
5454
{
5555
parent::setUp();
5656
parent::setTheme();
57+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
5758
$_SERVER['HTTP_USER_AGENT'] = '';
5859
$this->object = new Config();
5960
$GLOBALS['server'] = 0;

test/classes/ConsoleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class ConsoleTest extends AbstractTestCase
1313
{
1414
public function testGetScripts(): void
1515
{
16+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
1617
$console = new Console();
1718
$this->assertEquals(['console.js'], $console->getScripts());
1819
}

test/classes/Controllers/AbstractControllerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
*/
1818
class AbstractControllerTest extends AbstractTestCase
1919
{
20+
protected function setUp(): void
21+
{
22+
parent::setUp();
23+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
24+
}
25+
2026
public function testCheckParametersWithMissingParameters(): void
2127
{
2228
$_REQUEST = [];

test/classes/Controllers/CheckRelationsControllerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class CheckRelationsControllerTest extends AbstractTestCase
2727
protected function setUp(): void
2828
{
2929
parent::setUp();
30+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
3031
$this->dummyDbi = $this->createDbiDummy();
3132
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
3233
$GLOBALS['dbi'] = $this->dbi;

test/classes/Controllers/LintControllerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
*/
1717
class LintControllerTest extends AbstractTestCase
1818
{
19+
protected function setUp(): void
20+
{
21+
parent::setUp();
22+
$GLOBALS['dbi'] = $this->createDatabaseInterface();
23+
}
24+
1925
public function testWithoutParams(): void
2026
{
2127
$_POST = [];

0 commit comments

Comments
 (0)