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) {
2121 $ this ->createDefaultDisplayPreferences ();
2222 $ this ->createNotifications ();
2323
24+ Config::setConfigurationValues ('formcreator ' , ['schema_version ' => PLUGIN_FORMCREATOR_SCHEMA_VERSION ]);
25+
2426 return true ;
2527 }
2628
@@ -371,10 +373,13 @@ protected function deleteTicketRelation() {
371373 PluginFormcreatorCommon::setNotification ($ use_mailing );
372374 }
373375
376+ /**
377+ * Cleanups the database from plugin's itemtypes (tables and relations)
378+ */
374379 protected function deleteTables () {
375380 global $ DB ;
376381
377- // Drop tables
382+ // Keep these itemtypes as string because classes might be not avaiable (if plugin is inactive)
378383 $ itemtypes = [
379384 'PluginFormcreatorAnswer ' ,
380385 'PluginFormcreatorCategory ' ,
Original file line number Diff line number Diff line change @@ -84,6 +84,10 @@ public function testInstallPlugin() {
8484 $ PluginDBTest = new PluginDB ();
8585 $ PluginDBTest ->checkInstall ("formcreator " , "install " );
8686
87+ $ config = Config::getConfigurationValues ('formcreator ' );
88+ $ this ->assertArrayHasKey ('schema_version ' , $ config );
89+ $ this ->assertEquals ($ config ['schema_version ' ], PLUGIN_FORMCREATOR_SCHEMA_VERSION );
90+
8791 // Enable the plugin
8892 $ plugin ->activate ($ plugin ->fields ['id ' ]);
8993 $ 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() {
6464 $ rows = $ template ->find ("`itemtype` = 'PluginFormcreatorForm_Answer' " );
6565 $ this ->assertCount (0 , $ rows );
6666
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
6871 // - NotificationTemplateTranslation
6972 // - Notification_NotificationTemplate
7073 }
You can’t perform that action at this time.
0 commit comments