Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| TestPackageExport | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| getLabel | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFormTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getExportingFileName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| triggerTestExportEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getTestExporter | |
0.00% |
0 / 1 |
|
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) 2022 (original work) Open Assessment Technologies SA; |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\taoQtiTest\models\export\Formats\Metadata; |
| 24 | |
| 25 | use core_kernel_classes_Resource as Resource; |
| 26 | use oat\oatbox\event\EventManagerAwareTrait; |
| 27 | use oat\taoQtiTest\models\event\QtiTestMetadataExportEvent; |
| 28 | use oat\taoQtiTest\models\export\AbstractTestExport; |
| 29 | use oat\taoQtiTest\models\export\QtiTestExporterInterface; |
| 30 | |
| 31 | class TestPackageExport extends AbstractTestExport |
| 32 | { |
| 33 | use EventManagerAwareTrait; |
| 34 | |
| 35 | protected const VERSION = 'metadata'; |
| 36 | |
| 37 | public function getLabel(): string |
| 38 | { |
| 39 | return __('QTI Test Metadata'); |
| 40 | } |
| 41 | |
| 42 | protected function getFormTitle(): string |
| 43 | { |
| 44 | return sprintf('%s %s', __('Export'), $this->getLabel()); |
| 45 | } |
| 46 | |
| 47 | protected function getExportingFileName(string $userDefinedName): string |
| 48 | { |
| 49 | return sprintf('%s_%d_metadata.zip', $userDefinedName, time()); |
| 50 | } |
| 51 | |
| 52 | protected function triggerTestExportEvent(Resource $test) |
| 53 | { |
| 54 | $this->getEventManager()->trigger(new QtiTestMetadataExportEvent($test)); |
| 55 | } |
| 56 | |
| 57 | protected function getTestExporter(Resource $instance): QtiTestExporterInterface |
| 58 | { |
| 59 | return new QtiTestExporter($instance, $this->getZip()); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // for backward compatibility |
| 64 | // phpcs:disable PSR1.Files.SideEffects |
| 65 | class_alias(TestPackageExport::class, 'oat\\taoQtiTest\\models\\export\\metadata\\TestMetadataByClassExportHandler'); |
| 66 | // phpcs:enable PSR1.Files.SideEffects |