@@ -49,12 +49,15 @@ protected function setupGLPI() {
4949 $ CFG_GLPI = $ settings + $ CFG_GLPI ;
5050 }
5151
52+ /**
53+ * @engine inline
54+ */
5255 public function testInstallPlugin () {
5356 global $ DB ;
5457
5558 $ this ->setupGLPI ();
5659
57- $ this ->assertTrue ($ DB ->connected , " Problem connecting to the Database " );
60+ $ this ->assertTrue ($ DB ->connected , ' Problem connecting to the Database ' );
5861
5962 $ this ->login ('glpi ' , 'glpi ' );
6063
@@ -63,12 +66,12 @@ public function testInstallPlugin() {
6366 $ config ->deleteByCriteria (array ('context ' => 'formcreator ' ));
6467
6568 // Drop tables of the plugin if they exist
66- $ query = " SHOW TABLES " ;
69+ $ query = ' SHOW TABLES ' ;
6770 $ result = $ DB ->query ($ query );
6871 while ($ data = $ DB ->fetch_array ($ result )) {
6972
70- if (strstr ($ data [0 ], " glpi_plugin_formcreator " ) !== false ) {
71- $ DB ->query (" DROP TABLE " .$ data [0 ]);
73+ if (strstr ($ data [0 ], ' glpi_plugin_formcreator ' ) !== false ) {
74+ $ DB ->query (' DROP TABLE ' .$ data [0 ]);
7275 }
7376 }
7477
@@ -82,15 +85,21 @@ public function testInstallPlugin() {
8285 ob_end_clean ();
8386
8487 $ PluginDBTest = new PluginDB ();
85- $ PluginDBTest ->checkInstall (" formcreator " , " install " );
88+ $ PluginDBTest ->checkInstall (' formcreator ' , ' install ' );
8689
90+ // Check the version of the schema is saved
8791 $ config = Config::getConfigurationValues ('formcreator ' );
8892 $ this ->assertArrayHasKey ('schema_version ' , $ config );
89- $ this ->assertEquals ($ config ['schema_version ' ], PLUGIN_FORMCREATOR_SCHEMA_VERSION );
93+ $ this ->assertEquals (PLUGIN_FORMCREATOR_SCHEMA_VERSION , $ config ['schema_version ' ]);
94+
95+ // Check the cron task is created
96+ $ cronTask = new CronTask ();
97+ $ cronTask ->getFromDBbyName (PluginFormcreatorIssue::class, 'SyncIssues ' );
98+ $ this ->assertFalse ($ cronTask ->isNewItem ());
9099
91100 // Enable the plugin
92101 $ plugin ->activate ($ plugin ->fields ['id ' ]);
93- $ this ->assertTrue ($ plugin ->isActivated (" formcreator " ), " Cannot enable the plugin " );
102+ $ this ->assertTrue ($ plugin ->isActivated (' formcreator ' ), ' Cannot enable the plugin ' );
94103
95104 }
96105}
0 commit comments