Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
61 / 61
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
CsvTemplateSampleLineFactory
100.00% covered (success)
100.00%
61 / 61
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 createMultiple
100.00% covered (success)
100.00%
61 / 61
100.00% covered (success)
100.00%
1 / 1
1
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 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
19 */
20
21declare(strict_types=1);
22
23namespace oat\taoQtiItem\model\import\Factory;
24
25use oat\taoQtiItem\model\import\TemplateInterface;
26use oat\oatbox\service\ConfigurableService;
27
28class CsvTemplateSampleLineFactory extends ConfigurableService
29{
30    public function createMultiple(TemplateInterface $template): array
31    {
32        $correctResponse = array(
33            '[please remove] EXAMPLE 1 - item with correct answer',
34            'Select the correct response (no restriction on number of selectable choices).'
35            . 'The value in ""correct_answer"" should be choice identifiers (listed in the column header) '
36            . 'and not the actual text content of the choices. In this example, ""choice_2"" is the correct answer '
37            . 'and gives the score 1',
38            '0',
39            'en-US',
40            '0',
41            '0',
42            'text for choice_1',
43            'text for choice_2',
44            'text for choice_3',
45            'text for choice_4',
46            '',
47            '',
48            '',
49            '',
50            'choice_2'
51        );
52        $mapResponse = array(
53            '[please remove] EXAMPLE 2 - item with partial score',
54            'Select the correct response (the choices are shuffled, at least 1 choice must be selected and '
55            . 'maximum of 2 allowed, this item uses partial scoring)',
56            '1',
57            'en-US',
58            '1',
59            '2',
60            'A',
61            'B',
62            'C',
63            'D',
64            '3',
65            '0',
66            '-2',
67            '-1',
68            ''
69        );
70        $combinationResponse = array(
71            '[please remove] EXAMPLE 3 - item with both correct answer and partial score',
72            'Select the correct response (1 single choice allowed, the correct answer is ""X"" and ""Y"", '
73            . 'this item uses partial scoring)',
74            '0',
75            'en-US',
76            '0',
77            '1',
78            'W',
79            'X',
80            'Y',
81            'Z',
82            '-1',
83            '1',
84            '1',
85            '0',
86            'choice_2,choice_4'
87        );
88        return [
89            $correctResponse,
90            $mapResponse,
91            $combinationResponse
92        ];
93    }
94}