File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ public function install(Migration $migration) {
21
21
$ this ->createDefaultDisplayPreferences ();
22
22
$ this ->createNotifications ();
23
23
24
+ Config::setConfigurationValues ('formcreator ' , ['schema_version ' => PLUGIN_FORMCREATOR_SCHEMA_VERSION ]);
25
+
24
26
return true ;
25
27
}
26
28
@@ -371,10 +373,13 @@ protected function deleteTicketRelation() {
371
373
PluginFormcreatorCommon::setNotification ($ use_mailing );
372
374
}
373
375
376
+ /**
377
+ * Cleanups the database from plugin's itemtypes (tables and relations)
378
+ */
374
379
protected function deleteTables () {
375
380
global $ DB ;
376
381
377
- // Drop tables
382
+ // Keep these itemtypes as string because classes might be not avaiable (if plugin is inactive)
378
383
$ itemtypes = [
379
384
'PluginFormcreatorAnswer ' ,
380
385
'PluginFormcreatorCategory ' ,
Original file line number Diff line number Diff line change @@ -84,6 +84,10 @@ public function testInstallPlugin() {
84
84
$ PluginDBTest = new PluginDB ();
85
85
$ PluginDBTest ->checkInstall ("formcreator " , "install " );
86
86
87
+ $ config = Config::getConfigurationValues ('formcreator ' );
88
+ $ this ->assertArrayHasKey ('schema_version ' , $ config );
89
+ $ this ->assertEquals ($ config ['schema_version ' ], PLUGIN_FORMCREATOR_SCHEMA_VERSION );
90
+
87
91
// Enable the plugin
88
92
$ plugin ->activate ($ plugin ->fields ['id ' ]);
89
93
$ this ->assertTrue ($ plugin ->isActivated ("formcreator " ), "Cannot enable the plugin " );
Original file line number Diff line number Diff line change @@ -64,7 +64,10 @@ public function testUninstall() {
64
64
$ rows = $ template ->find ("`itemtype` = 'PluginFormcreatorForm_Answer' " );
65
65
$ this ->assertCount (0 , $ rows );
66
66
67
- // TODO: need to find a r eliable way to detect not clenaed
67
+ $ config = Config::getConfigurationValues ('formcreator ' );
68
+ $ this ->assertArrayNotHasKey ('schema_version ' , $ config );
69
+
70
+ // TODO: need to find a reliable way to detect not clenaed
68
71
// - NotificationTemplateTranslation
69
72
// - Notification_NotificationTemplate
70
73
}
You can’t perform that action at this time.
0 commit comments