Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/*
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; under version 2
9 * of the License (non-upgradable).
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 *
20 * Copyright (c) 2013-2020 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
21 *
22 */
23
24use oat\oatbox\service\ServiceManager;
25
26$testService = ServiceManager::getServiceManager()->get(taoQtiTest_models_classes_QtiTestService::class);
27$testClass = $testService->getRootClass();
28$samplesDirectory = new DirectoryIterator(__DIR__);
29
30try {
31    foreach ($samplesDirectory as $file) {
32        if ($file->isReadable() && $file->isFile() && 'zip' === $file->getExtension()) {
33            $report = $testService->importMultipleTests($testClass, $file->getRealPath());
34        }
35    }
36} catch (Throwable $e) {
37    common_Logger::e(
38        'An error occurred while importing QTI Test Example. The system reported the following error: '
39            . $e->getMessage()
40    );
41    throw $e;
42}