Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
addValidationSettings
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 __invoke
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace oat\taoQtiItem\install\scripts;
4
5use oat\oatbox\service\ServiceManager;
6use oat\taoQtiItem\model\ValidationService;
7
8class addValidationSettings extends \common_ext_action_InstallAction
9{
10    public function __invoke($params)
11    {
12
13        $this->setServiceLocator(ServiceManager::getServiceManager());
14        $serviceManager = $this->getServiceManager();
15
16        $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
17        if ($ext->hasConfig('contentValidation')) {
18            $ext->unsetConfig('contentValidation');
19        }
20
21        if ($ext->hasConfig('manifestValidation')) {
22            $ext->unsetConfig('manifestValidation');
23        }
24
25        //Set Validation service
26        $validationService = new ValidationService();
27        $validationService->setServiceManager($serviceManager);
28        $serviceManager->register(ValidationService::SERVICE_ID, $validationService);
29
30        return new \common_report_Report(
31            \common_report_Report::TYPE_SUCCESS,
32            'Validation service has been successfully set up'
33        );
34    }
35}