Skip to content

Commit 46acb2e

Browse files
committed
test(Install): isolate plugin wipe before install
1 parent 863f77b commit 46acb2e

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

tests/install/PluginInstallTest.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,16 @@ public function setUp(): void
8181
self::login('glpi', 'glpi', true);
8282
}
8383

84-
8584
/**
86-
* Execute plugin installation in the context if tests
85+
* Helper method to wipe all plugin data
86+
*
87+
* @return void
8788
*/
88-
protected function executeInstallation()
89-
{
89+
protected function wipePlugin() {
9090
/** @var DBmysql */
9191
global $DB;
9292

9393
$plugin_name = TEST_PLUGIN_NAME;
94-
95-
$this->assertTrue($DB->connected);
96-
9794
//Drop plugin configuration if exists
9895
$config = new Config();
9996
$config->deleteByCriteria(['context' => $plugin_name]);
@@ -103,6 +100,20 @@ protected function executeInstallation()
103100
foreach ($result as $data) {
104101
$DB->dropTable($data['TABLE_NAME']);
105102
}
103+
}
104+
105+
/**
106+
* Execute plugin installation in the context if tests
107+
*/
108+
protected function executeInstallation()
109+
{
110+
/** @var DBmysql */
111+
global $DB;
112+
113+
$plugin_name = TEST_PLUGIN_NAME;
114+
115+
$this->assertTrue($DB->connected);
116+
$this->wipePlugin();
106117

107118
// Reset logs
108119
$this->resetGLPILogs();

0 commit comments

Comments
 (0)