Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 133
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
TestQtiServiceProvider
0.00% covered (danger)
0.00%
0 / 133
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 __invoke
0.00% covered (danger)
0.00%
0 / 133
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; under version 2
7 * of the License (non-upgradable).
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 *
18 * Copyright (c) 2021-2024 (original work) Open Assessment Technologies SA;
19 */
20
21declare(strict_types=1);
22
23namespace oat\taoQtiTest\model\Container;
24
25use oat\generis\model\data\Ontology;
26use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface;
27use oat\oatbox\event\EventManager;
28use oat\oatbox\log\LoggerService;
29use oat\tao\model\featureFlag\FeatureFlagChecker;
30use oat\taoDelivery\model\execution\DeliveryExecutionService;
31use oat\taoDelivery\model\execution\StateServiceInterface;
32use oat\taoDelivery\model\RuntimeService;
33use oat\taoQtiTest\model\Domain\Model\ItemResponseRepositoryInterface;
34use oat\taoQtiTest\model\Domain\Model\QtiTestRepositoryInterface;
35use oat\taoQtiTest\model\Domain\Model\ToolsStateRepositoryInterface;
36use oat\taoQtiTest\model\Infrastructure\QtiItemResponseRepository;
37use oat\taoQtiTest\model\Infrastructure\QtiItemResponseValidator;
38use oat\taoQtiTest\model\Infrastructure\QtiToolsStateRepository;
39use oat\taoQtiTest\model\Infrastructure\QtiTestRepository;
40use oat\taoQtiTest\model\Infrastructure\Validation\ChoiceResponseValidationStrategy;
41use oat\taoQtiTest\model\Infrastructure\Validation\ExtraQtiInteractionResponseValidator;
42use oat\taoQtiTest\model\Service\ConcurringSessionService;
43use oat\taoQtiTest\model\Service\ExitTestService;
44use oat\taoQtiTest\model\Service\ListItemsService;
45use oat\taoQtiTest\model\Service\MoveService;
46use oat\taoQtiTest\model\Service\PauseService;
47use oat\taoQtiTest\model\Service\PluginManagerService;
48use oat\taoQtiTest\model\Service\SkipService;
49use oat\taoQtiTest\model\Service\StoreTraceVariablesService;
50use oat\taoQtiTest\model\Service\TimeoutService;
51use oat\taoQtiTest\models\runner\QtiRunnerService;
52use oat\taoQtiTest\models\runner\time\TimerAdjustmentServiceInterface;
53use oat\taoQtiTest\models\TestModelService;
54use oat\taoQtiTest\models\TestSessionService;
55use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
56use common_ext_ExtensionsManager as ExtensionsManager;
57
58use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
59
60class TestQtiServiceProvider implements ContainerServiceProviderInterface
61{
62    public function __invoke(ContainerConfigurator $configurator): void
63    {
64        $services = $configurator->services();
65
66        $services
67            ->set(ItemResponseRepositoryInterface::class, QtiItemResponseRepository::class)
68            ->public()
69            ->args(
70                [
71                    service(QtiRunnerService::SERVICE_ID),
72                    service(FeatureFlagChecker::class),
73                    service(QtiItemResponseValidator::class),
74                    service(ExtraQtiInteractionResponseValidator::class),
75                ]
76            );
77
78        $services
79            ->set(ToolsStateRepositoryInterface::class, QtiToolsStateRepository::class)
80            ->public()
81            ->args(
82                [
83                    service(QtiRunnerService::SERVICE_ID)
84                ]
85            );
86
87        $services
88            ->set(ListItemsService::class, ListItemsService::class)
89            ->public()
90            ->args(
91                [
92                    service(QtiRunnerService::SERVICE_ID),
93                    service(LoggerService::SERVICE_ID)
94                ]
95            );
96
97        $services
98            ->set(ExitTestService::class, ExitTestService::class)
99            ->public()
100            ->args(
101                [
102                    service(QtiRunnerService::SERVICE_ID),
103                    service(ItemResponseRepositoryInterface::class),
104                    service(ToolsStateRepositoryInterface::class),
105                ]
106            );
107
108        $services
109            ->set(MoveService::class, MoveService::class)
110            ->public()
111            ->args(
112                [
113                    service(QtiRunnerService::SERVICE_ID),
114                    service(ItemResponseRepositoryInterface::class),
115                    service(ToolsStateRepositoryInterface::class),
116                ]
117            );
118
119        $services
120            ->set(PauseService::class, PauseService::class)
121            ->public()
122            ->args(
123                [
124                    service(QtiRunnerService::SERVICE_ID),
125                    service(ItemResponseRepositoryInterface::class),
126                ]
127            );
128
129        $services
130            ->set(SkipService::class, SkipService::class)
131            ->public()
132            ->args(
133                [
134                    service(QtiRunnerService::SERVICE_ID),
135                    service(ItemResponseRepositoryInterface::class),
136                    service(ToolsStateRepositoryInterface::class),
137                ]
138            );
139
140        $services
141            ->set(StoreTraceVariablesService::class, StoreTraceVariablesService::class)
142            ->public()
143            ->args(
144                [
145                    service(QtiRunnerService::SERVICE_ID),
146                    service(EventManager::SERVICE_ID),
147                    service(LoggerService::SERVICE_ID),
148                ]
149            );
150
151        $services
152            ->set(TimeoutService::class, TimeoutService::class)
153            ->public()
154            ->args(
155                [
156                    service(QtiRunnerService::SERVICE_ID),
157                    service(ItemResponseRepositoryInterface::class),
158                    service(ToolsStateRepositoryInterface::class),
159                ]
160            );
161
162        $services
163            ->set(QtiTestRepositoryInterface::class, QtiTestRepository::class)
164            ->public()
165            ->args(
166                [
167                    service(Ontology::SERVICE_ID),
168                    service(TestModelService::SERVICE_ID),
169                ]
170            );
171
172        $services
173            ->set(ConcurringSessionService::class, ConcurringSessionService::class)
174            ->public()
175            ->args(
176                [
177                    service(LoggerService::SERVICE_ID),
178                    service(QtiRunnerService::SERVICE_ID),
179                    service(RuntimeService::SERVICE_ID),
180                    service(DeliveryExecutionService::SERVICE_ID),
181                    service(FeatureFlagChecker::class),
182                    service(StateServiceInterface::SERVICE_ID),
183                    service(TestSessionService::SERVICE_ID),
184                    service(TimerAdjustmentServiceInterface::SERVICE_ID),
185                ]
186            );
187
188        $services
189            ->set(QtiItemResponseValidator::class, QtiItemResponseValidator::class)
190            ->public();
191
192        $services
193            ->set(PluginManagerService::class, PluginManagerService::class)
194            ->args(
195                [
196                    service(Ontology::SERVICE_ID),
197                    service(ExtensionsManager::SERVICE_ID),
198                ]
199            )
200            ->public();
201
202        $services->set(ChoiceResponseValidationStrategy::class, ChoiceResponseValidationStrategy::class);
203        $services
204            ->set(ExtraQtiInteractionResponseValidator::class, ExtraQtiInteractionResponseValidator::class)
205            ->public()
206            ->args(
207                [
208                    service(ChoiceResponseValidationStrategy::class)
209                ]
210            );
211    }
212}