/**
  * Test removing plugin from <i>client_lib_config_registry.conf.php</i> config
  * Be aware that in case of fatal error in the config can remain test data.
  */
 public function testRemovePlugin()
 {
     $registry = TestRunnerClientConfigRegistry::getRegistry();
     if ($registry->isRegistered(TestRunnerClientConfigRegistry::RUNNER)) {
         $this->currentConfig = $registry->get(TestRunnerClientConfigRegistry::RUNNER);
         $registry->registerPlugin('must/be/removed', 'categoryName');
         $testConfig = $registry->get(TestRunnerClientConfigRegistry::RUNNER);
         $this->assertNotFalse(array_search(['module' => 'must/be/removed', 'category' => 'categoryName', 'position' => null], $testConfig['plugins']));
         $registry->removePlugin('must/be/removed', 'categoryName');
         $testConfig = $registry->get(TestRunnerClientConfigRegistry::RUNNER);
         $this->assertFalse(array_search(['module' => 'must/be/removed', 'category' => 'categoryName', 'position' => null], $testConfig['plugins']));
     }
 }
 /**
  * 
  * @param string $initialVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     // add testrunner config
     if ($currentVersion == '2.6') {
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('testRunner', array('progress-indicator' => 'percentage', 'timerWarning' => array('assessmentItemRef' => null, 'assessmentSection' => 300, 'testPart' => null)));
         $currentVersion = '2.6.1';
     }
     if ($currentVersion == '2.6.1') {
         $config = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->getConfig('testRunner');
         $config['exitButton'] = false;
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('testRunner', $config);
         $currentVersion = '2.6.2';
     }
     // add testrunner review screen config
     if ($currentVersion == '2.6.2') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $extension->setConfig('testRunner', array_merge($config, array('test-taker-review' => false, 'test-taker-review-region' => 'left', 'test-taker-review-section-only' => false, 'test-taker-review-prevents-unseen' => true)));
         $currentVersion = '2.6.3';
     }
     // adjust testrunner config
     if ($currentVersion == '2.6.3') {
         $defaultConfig = array('timerWarning' => array('assessmentItemRef' => null, 'assessmentSection' => null, 'testPart' => null), 'progress-indicator' => 'percentage', 'progress-indicator-scope' => 'testSection', 'test-taker-review' => false, 'test-taker-review-region' => 'left', 'test-taker-review-section-only' => false, 'test-taker-review-prevents-unseen' => true, 'exitButton' => false);
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         foreach ($defaultConfig as $key => $value) {
             if (!isset($config[$key])) {
                 $config[$key] = $value;
             }
         }
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.6.4';
     }
     if ($currentVersion == '2.6.4') {
         $currentVersion = '2.7.0';
     }
     // add markForReview button
     if ($currentVersion === '2.7.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('markForReview', array('label' => 'Mark for review', 'icon' => 'anchor', 'hook' => 'taoQtiTest/testRunner/actionBar/markForReview'));
         $currentVersion = '2.8.0';
     }
     // adjust testrunner config: set the review scope
     if ($currentVersion == '2.8.0') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-scope'] = 'test';
         unset($config['test-taker-review-section-only']);
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.9.0';
     }
     // add show/hide button
     // adjust testrunner config: set the "can collapse" option
     if ($currentVersion == '2.9.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('collapseReview', array('title' => 'Show/Hide the review screen', 'label' => 'Review', 'icon' => 'mobile-menu', 'hook' => 'taoQtiTest/testRunner/actionBar/collapseReview', 'order' => -1));
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-can-collapse'] = false;
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.10.0';
     }
     // adjust testrunner config: set the item sequence number options
     if ($currentVersion == '2.10.0') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-force-title'] = false;
         $config['test-taker-review-item-title'] = 'Item %d';
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.11.0';
     }
     if ($currentVersion == '2.11.0') {
         // correct access roles
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#DeliveryRole', array('act' => 'taoQtiTest', 'mod' => 'TestCommand')));
         $currentVersion = '2.11.1';
     }
     // adjust testrunner config: set the force progress indicator display
     if ($currentVersion == '2.11.1') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['progress-indicator-forced'] = false;
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.12.0';
     }
     return $currentVersion;
 }
Example #3
0
 /**
  *
  * @param string $initialVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     // add testrunner config
     if ($currentVersion == '2.6') {
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('testRunner', array('progress-indicator' => 'percentage', 'timerWarning' => array('assessmentItemRef' => null, 'assessmentSection' => 300, 'testPart' => null)));
         $currentVersion = '2.6.1';
     }
     if ($currentVersion == '2.6.1') {
         $config = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->getConfig('testRunner');
         $config['exitButton'] = false;
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('testRunner', $config);
         $currentVersion = '2.6.2';
     }
     // add testrunner review screen config
     if ($currentVersion == '2.6.2') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $extension->setConfig('testRunner', array_merge($config, array('test-taker-review' => false, 'test-taker-review-region' => 'left', 'test-taker-review-section-only' => false, 'test-taker-review-prevents-unseen' => true)));
         $currentVersion = '2.6.3';
     }
     // adjust testrunner config
     if ($currentVersion == '2.6.3') {
         $defaultConfig = array('timerWarning' => array('assessmentItemRef' => null, 'assessmentSection' => null, 'testPart' => null), 'progress-indicator' => 'percentage', 'progress-indicator-scope' => 'testSection', 'test-taker-review' => false, 'test-taker-review-region' => 'left', 'test-taker-review-section-only' => false, 'test-taker-review-prevents-unseen' => true, 'exitButton' => false);
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         foreach ($defaultConfig as $key => $value) {
             if (!isset($config[$key])) {
                 $config[$key] = $value;
             }
         }
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.6.4';
     }
     if ($currentVersion == '2.6.4') {
         $currentVersion = '2.7.0';
     }
     // add markForReview button
     if ($currentVersion === '2.7.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('markForReview', array('label' => 'Mark for review', 'icon' => 'anchor', 'hook' => 'taoQtiTest/testRunner/actionBar/markForReview'));
         $currentVersion = '2.8.0';
     }
     // adjust testrunner config: set the review scope
     if ($currentVersion == '2.8.0') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-scope'] = 'test';
         unset($config['test-taker-review-section-only']);
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.9.0';
     }
     // add show/hide button
     // adjust testrunner config: set the "can collapse" option
     if ($currentVersion == '2.9.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('collapseReview', array('title' => 'Show/Hide the review screen', 'label' => 'Review', 'icon' => 'mobile-menu', 'hook' => 'taoQtiTest/testRunner/actionBar/collapseReview', 'order' => -1));
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-can-collapse'] = false;
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.10.0';
     }
     // adjust testrunner config: set the item sequence number options
     if ($currentVersion == '2.10.0') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-force-title'] = false;
         $config['test-taker-review-item-title'] = 'Item %d';
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.11.0';
     }
     if ($currentVersion == '2.11.0') {
         $currentVersion = '2.11.1';
     }
     // adjust testrunner config: set the force progress indicator display
     if ($currentVersion == '2.11.1') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['progress-indicator-forced'] = false;
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.12.0';
     }
     // update the test taker review action buttons
     if ($currentVersion == '2.12.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('collapseReview', array('hook' => 'taoQtiTest/testRunner/actionBar/collapseReview', 'order' => 'first', 'title' => null, 'label' => null, 'icon' => null));
         $registry->registerQtiTools('markForReview', array('hook' => 'taoQtiTest/testRunner/actionBar/markForReview', 'order' => 'last', 'title' => null, 'label' => null, 'icon' => null));
         $currentVersion = '2.13.0';
     }
     // adjust testrunner config: set the next section button display
     if ($currentVersion == '2.13.0') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['next-section'] = false;
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.14.0';
     }
     if ($currentVersion === '2.14.0') {
         try {
             $this->getServiceManager()->get('taoQtiTest/SessionStateService');
         } catch (ServiceNotFoundException $e) {
             $sessionStateService = new SessionStateService();
             $sessionStateService->setServiceManager($this->getServiceManager());
             $this->getServiceManager()->register('taoQtiTest/SessionStateService', $sessionStateService);
         }
         $currentVersion = '2.15.0';
     }
     if ($currentVersion === '2.15.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('comment', array('hook' => 'taoQtiTest/testRunner/actionBar/comment'));
         $currentVersion = '2.16.0';
     }
     $this->setVersion($currentVersion);
     if ($this->isBetween('2.16.0', '2.17.0')) {
         $proctorRole = new \core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAO.rdf#DeliveryRole');
         $accessService = \funcAcl_models_classes_AccessService::singleton();
         $accessService->grantModuleAccess($proctorRole, 'taoQtiTest', 'Runner');
         try {
             $this->getServiceManager()->get(QtiRunnerService::CONFIG_ID);
         } catch (ServiceNotFoundException $e) {
             $service = new QtiRunnerService();
             $service->setServiceManager($this->getServiceManager());
             $this->getServiceManager()->register(QtiRunnerService::CONFIG_ID, $service);
         }
         $this->setVersion('2.17.0');
     }
     $this->skip('2.17.0', '2.19.1');
     if ($this->isVersion('2.19.1')) {
         // sets default plugin options
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         if (!array_key_exists('plugins', $config)) {
             $config['plugins'] = null;
         }
         $extension->setConfig('testRunner', $config);
         $this->setVersion('2.20.0');
     }
     $this->skip('2.20.0', '2.21.1');
     if ($this->isVersion('2.21.1')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $extension->setConfig('testRunner', array_merge($config, array('csrf-token' => true)));
         $this->setVersion('2.22.0');
     }
     if ($this->isVersion('2.22.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['timer']['target'] = 'server';
         $extension->setConfig('testRunner', $config);
         $this->setVersion('2.23.0');
     }
     $this->skip('2.23.0', '2.24.0');
     if ($this->isVersion('2.24.0')) {
         $className = \taoQtiTest_helpers_SessionManager::DEFAULT_TEST_SESSION;
         try {
             $deliveryConfig = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery')->getConfig('deliveryServer');
             if ($deliveryConfig) {
                 $deliveryContainer = $deliveryConfig->getOption('deliveryContainer');
                 if (false !== strpos($deliveryContainer, 'DeliveryClientContainer')) {
                     $className = 'oat\\taoQtiTest\\models\\runner\\session\\TestSession';
                 }
             }
         } catch (\common_ext_ExtensionException $e) {
         }
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-session'] = $className;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('2.25.0');
     }
     if ($this->isVersion('2.25.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['plugins']['overlay']['full'] = false;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('2.26.0');
     }
     $this->skip('2.26.0', '2.27.0');
     if ($this->isVersion('2.27.0')) {
         $serviceExtension = 'taoQtiTest';
         $serviceController = 'Runner';
         try {
             $deliveryConfig = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery')->getConfig('testRunner');
             if ($deliveryConfig) {
                 $serviceExtension = $deliveryConfig['serviceExtension'];
                 $serviceController = $deliveryConfig['serviceController'];
             }
         } catch (\common_ext_ExtensionException $e) {
         }
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['bootstrap'] = ['serviceExtension' => $serviceExtension, 'serviceController' => $serviceController, 'communication' => ['enabled' => false, 'type' => 'poll', 'extension' => null, 'controller' => null, 'action' => 'messages', 'service' => null, 'params' => []]];
         $extension->setConfig('testRunner', $config);
         try {
             $this->getServiceManager()->get(QtiCommunicationService::CONFIG_ID);
         } catch (ServiceNotFoundException $e) {
             $service = new QtiCommunicationService();
             $service->setServiceManager($this->getServiceManager());
             $this->getServiceManager()->register(QtiCommunicationService::CONFIG_ID, $service);
         }
         $this->setVersion('2.28.0');
     }
     if ($this->isVersion('2.28.0')) {
         $testRunnerConfig = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->getConfig('testRunner');
         if (array_key_exists('timerWarning', $testRunnerConfig)) {
             foreach ($testRunnerConfig['timerWarning'] as &$value) {
                 if ($value !== null && is_int($value)) {
                     $value = [$value => 'warning'];
                 }
             }
             \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('testRunner', $testRunnerConfig);
         }
         $this->setVersion('2.29.0');
     }
     if ($this->isVersion('2.29.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['bootstrap']['timeout'] = 0;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('2.30.0');
     }
     if ($this->isVersion('2.30.0')) {
         try {
             $service = $this->getServiceManager()->get(QtiCommunicationService::CONFIG_ID);
         } catch (ServiceNotFoundException $e) {
             $service = new QtiCommunicationService();
         }
         $service->setServiceManager($this->getServiceManager());
         $service->attachChannel(new TestStateChannel(), QtiCommunicationService::CHANNEL_TYPE_OUTPUT);
         $this->getServiceManager()->register(QtiCommunicationService::CONFIG_ID, $service);
         $this->setVersion('2.31.0');
     }
     if ($this->isVersion('2.31.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         if (!isset($config['bootstrap']) || isset($config['bootstrap']['timeout']) && count($config['bootstrap']) == 1) {
             $config['bootstrap'] = array_merge($config['bootstrap'], ['serviceExtension' => 'taoQtiTest', 'serviceController' => 'Runner', 'communication' => ['enabled' => false, 'type' => 'poll', 'extension' => null, 'controller' => null, 'action' => 'messages', 'service' => null, 'params' => []]]);
             $extension->setConfig('testRunner', $config);
         }
         $this->setVersion('2.31.1');
     }
     $this->skip('2.31.1', '3.0.0');
     if ($this->isVersion('3.0.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['enable-allow-skipping'] = false;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('3.1.0');
     }
     $this->skip('3.1.0', '3.4.0');
     if ($this->isVersion('3.4.0')) {
         $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $uri = $ext->getConfig(\taoQtiTest_models_classes_QtiTestService::CONFIG_QTITEST_FILESYSTEM);
         $dir = new \core_kernel_file_File($uri);
         $fs = $dir->getFileSystem();
         \taoQtiTest_models_classes_QtiTestService::singleton()->setQtiTestFileSystem($fs->getUri());
         $this->setVersion('4.0.0');
     }
     $this->skip('4.0.0', '4.6.0');
     if ($this->isVersion('4.6.0')) {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $runnerConfig = $registry->get(TestRunnerClientConfigRegistry::RUNNER);
         if (isset($runnerConfig['plugins']) && is_array($runnerConfig['plugins'])) {
             foreach ($runnerConfig['plugins'] as $plugin) {
                 //if the plugin is registered
                 if ($plugin['module'] == 'taoQtiTest/runner/plugins/controls/disableRightClick') {
                     //we migrate the category
                     $registry->removePlugin('taoQtiTest/runner/plugins/controls/disableRightClick', 'controls', null);
                     $registry->registerPlugin('taoQtiTest/runner/plugins/security/disableRightClick', 'security', null);
                     break;
                 }
             }
         }
         $this->setVersion('4.7.0');
     }
     $this->skip('4.7.0', '4.8.2');
     if ($this->isVersion('4.8.2')) {
         //regsiter the core plugins into taoTests
         $registerCorePlugins = new RegisterTestRunnerPlugins();
         $registerCorePlugins([]);
         $registry = PluginRegistry::getRegistry();
         //list the installed plugins
         $oldRegistry = TestRunnerClientConfigRegistry::getRegistry();
         $runnerConfig = $oldRegistry->get(TestRunnerClientConfigRegistry::RUNNER);
         if (isset($runnerConfig['plugins']) && is_array($runnerConfig['plugins'])) {
             foreach ($runnerConfig['plugins'] as $plugin) {
                 //if they are not yet in the config, migrate them automatically
                 if (!$registry->isRegistered($plugin['module'])) {
                     $pluginId = basename($plugin['module']);
                     $pluginName = ucfirst(join(preg_split('/(?=[A-Z])/', $pluginId), ' '));
                     $registry->register(TestPlugin::fromArray(['id' => $pluginId, 'name' => $pluginName, 'module' => $plugin['module'], 'category' => $plugin['category'], 'position' => $plugin['position'], 'active' => true]));
                 }
             }
         }
         //then remove the old config
         $registry->remove(TestRunnerClientConfigRegistry::RUNNER);
         $registry->remove(TestRunnerClientConfigRegistry::RUNNER_PROD);
         $this->setVersion('5.0.0');
     }
     $this->skip('5.0.0', '5.4.0');
     if ($this->isVersion('5.4.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['plugins']['collapser'] = ['collapseTools' => true, 'collapseNavigation' => false, 'hover' => false];
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.5.0');
     }
     $this->skip('5.5.0', '5.5.3');
     if ($this->isVersion('5.5.3')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['force-branchrules'] = false;
         $config['force-preconditions'] = false;
         $config['path-tracking'] = false;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.6.0');
     }
     if ($this->isVersion('5.6.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['always-allow-jumps'] = false;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.7.0');
     }
     $this->skip('5.7.0', '5.8.4');
     if ($this->isVersion('5.8.4')) {
         OntologyUpdater::syncModels();
         $testModelService = new TestModelService(array('exportHandlers' => array(new \taoQtiTest_models_classes_export_TestExport(), new \taoQtiTest_models_classes_export_TestExport22()), 'importHandlers' => array(new \taoQtiTest_models_classes_import_TestImport())));
         $testModelService->setServiceManager($this->getServiceManager());
         $this->getServiceManager()->register(TestModelService::SERVICE_ID, $testModelService);
         $this->setVersion('5.9.0');
     }
     $this->skip('5.9.0', '5.10.2');
     if ($this->isVersion('5.10.2')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['check-informational'] = false;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.11.0');
     }
     if ($this->isVersion('5.11.0')) {
         $registry = PluginRegistry::getRegistry();
         $registry->register(TestPlugin::fromArray(['id' => 'modalFeedback', 'name' => 'QTI modal feedbacks', 'module' => 'taoQtiTest/runner/plugins/content/modalFeedback/modalFeedback', 'description' => 'Display Qti modalFeedback element', 'category' => 'content', 'active' => true, 'tags' => ['core', 'qti', 'required']]));
         $this->setVersion('5.12.0');
     }
     $this->skip('5.12.0', '5.16.2');
     if ($this->isVersion('5.16.2')) {
         $service = new TestExporter();
         $service->setServiceManager($this->getServiceManager());
         $this->getServiceManager()->register(TestMetadataExporter::SERVICE_ID, $service);
         $this->setVersion('5.17.0');
     }
     $this->skip('5.17.0', '5.17.3');
     if ($this->isVersion('5.17.3')) {
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('TestCompiler', array('enable-category-rules-generation' => false));
         $categoryRulesService = new TestCategoryRulesService(array('score-variable-identifier' => 'SCORE', 'weight-identifier' => 'WEIGHT', 'category-exclusions' => array('/x-tao-/'), 'flags' => TestCategoryRulesGenerator::COUNT | TestCategoryRulesGenerator::CORRECT | TestCategoryRulesGenerator::SCORE));
         $categoryRulesService->setServiceManager($this->getServiceManager());
         $this->getServiceManager()->register(TestCategoryRulesService::SERVICE_ID, $categoryRulesService);
         $this->setVersion('5.18.0');
     }
     $this->skip('5.18.0', '5.23.0');
     if ($this->isVersion('5.23.0')) {
         $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $uri = $ext->getConfig(\taoQtiTest_models_classes_QtiTestService::CONFIG_QTITEST_FILESYSTEM);
         if (!is_string($uri)) {
             if (is_object($uri) && $uri instanceof \core_kernel_classes_Resource) {
                 \taoQtiTest_models_classes_QtiTestService::singleton()->setQtiTestFileSystem($uri->getUri());
             } else {
                 throw new \common_exception_InconsistentData('Invalid qti test storage directory configuration');
             }
         }
         $this->setVersion('5.23.1');
     }
     $this->skip('5.23.1', '5.25.1');
     if ($this->isVersion('5.25.1')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-unanswered-items-message'] = true;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.26.0');
     }
     if ($this->isVersion('5.26.0')) {
         $registry = PluginRegistry::getRegistry();
         $registry->register(TestPlugin::fromArray(['id' => 'documentViewer', 'name' => 'Document Viewer', 'module' => 'taoQtiTest/runner/plugins/tools/documentViewer/documentViewer', 'description' => 'Display a document as requested by an event', 'category' => 'tools', 'active' => false, 'tags' => []]));
         $this->setVersion('5.27.0');
     }
     if ($this->isVersion('5.27.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['keep-timer-up-to-timeout'] = false;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.28.0');
     }
     $this->skip('5.28.0', '5.30.1');
     if ($this->isVersion('5.30.1')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['allow-shortcuts'] = true;
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.31.0');
     }
     $this->skip('5.31.0', '5.31.1');
     if ($this->isVersion('5.31.1')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['shortcuts'] = ['calculator' => ['toggle' => 'C'], 'zoom' => ['in' => 'I', 'out' => 'O'], 'comment' => ['toggle' => 'A'], 'itemThemeSwitcher' => ['toggle' => 'T'], 'review' => ['toggle' => 'R', 'flag' => 'M']];
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.32.0');
     }
     $this->skip('5.32.0', '5.32.1');
     if ($this->isVersion('5.32.1')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['shortcuts']['next'] = ['trigger' => 'J'];
         $config['shortcuts']['previous'] = ['trigger' => 'K'];
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.33.0');
     }
     if ($this->isVersion('5.33.0')) {
         $registry = PluginRegistry::getRegistry();
         $registry->register(TestPlugin::fromArray(['id' => 'responsesAccess', 'name' => 'Shortcuts to access the item responses', 'module' => 'taoQtiTest/runner/plugins/content/accessibility/responsesAccess', 'description' => 'Provide a way to navigate between item responses using the keyboard', 'category' => 'content', 'active' => true, 'tags' => ['core', 'qti']]));
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['shortcuts']['responsesAccess'] = ['previous' => 'Shift+Tab', 'next' => 'Tab'];
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.34.0');
     }
     $this->skip('5.34.0', '5.36.0');
     if ($this->isVersion('5.36.0')) {
         $registry = PluginRegistry::getRegistry();
         $registry->register(TestPlugin::fromArray(['id' => 'highlighter', 'name' => 'Text Highlighter', 'module' => 'taoQtiTest/runner/plugins/tools/highlighter/plugin', 'description' => 'Allows the test taker to highlight text', 'category' => 'tools', 'active' => true, 'tags' => []]));
         $this->setVersion('5.37.0');
     }
     if ($this->isVersion('5.37.0')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['shortcuts']['itemThemeSwitcher'] = ['toggle' => 'T', 'loop' => 'Y', 'select' => 'U'];
         $extension->setConfig('testRunner', $config);
         $this->setVersion('5.37.1');
     }
     $this->skip('5.37.1', '5.38.1');
     if ($this->isVersion('5.38.1')) {
         $registry = PluginRegistry::getRegistry();
         $registry->register(TestPlugin::fromArray(['id' => 'highlighter', 'name' => 'Text Highlighter', 'module' => 'taoQtiTest/runner/plugins/tools/highlighter/plugin', 'description' => 'Allows the test taker to highlight text', 'category' => 'tools', 'active' => false, 'tags' => []]));
         $this->setVersion('5.38.2');
     }
     $this->skip('5.38.2', '5.39.1');
 }