Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| CopierServiceProvider | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||
| __invoke | n/a |
0 / 0 |
n/a |
0 / 0 |
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) 2023 (original work) Open Assessment Technologies SA. |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\taoTests\models\Copier; |
| 24 | |
| 25 | use oat\generis\model\data\Ontology; |
| 26 | use oat\generis\model\OntologyRdf; |
| 27 | use oat\generis\model\OntologyRdfs; |
| 28 | use oat\tao\model\resources\Service\InstanceCopierProxy; |
| 29 | use oat\tao\model\TaoOntology; |
| 30 | use oat\oatbox\event\EventManager; |
| 31 | use oat\tao\model\resources\Service\ClassCopier; |
| 32 | use oat\tao\model\resources\Service\InstanceCopier; |
| 33 | use oat\tao\model\resources\Service\ClassCopierProxy; |
| 34 | use oat\tao\model\resources\Service\ClassMetadataCopier; |
| 35 | use oat\tao\model\resources\Service\ClassMetadataMapper; |
| 36 | use oat\tao\model\resources\Service\InstanceMetadataCopier; |
| 37 | use oat\tao\model\resources\Service\RootClassesListService; |
| 38 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
| 39 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
| 40 | use taoTests_models_classes_TestsService; |
| 41 | |
| 42 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
| 43 | use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; |
| 44 | |
| 45 | /** |
| 46 | * @codeCoverageIgnore |
| 47 | */ |
| 48 | class CopierServiceProvider implements ContainerServiceProviderInterface |
| 49 | { |
| 50 | public function __invoke(ContainerConfigurator $configurator): void |
| 51 | { |
| 52 | $services = $configurator->services(); |
| 53 | |
| 54 | $services |
| 55 | ->set(taoTests_models_classes_TestsService::class, taoTests_models_classes_TestsService::class) |
| 56 | ->factory(taoTests_models_classes_TestsService::class . '::singleton'); |
| 57 | |
| 58 | $services |
| 59 | ->get(InstanceMetadataCopier::class) |
| 60 | ->call( |
| 61 | 'addPropertyUrisToBlacklist', |
| 62 | [ |
| 63 | [ |
| 64 | taoTests_models_classes_TestsService::PROPERTY_TEST_CONTENT, |
| 65 | OntologyRdfs::RDFS_LABEL, |
| 66 | ] |
| 67 | ] |
| 68 | ); |
| 69 | |
| 70 | $services |
| 71 | ->set(TestContentCopier::class, TestContentCopier::class) |
| 72 | ->args( |
| 73 | [ |
| 74 | service(taoTests_models_classes_TestsService::class), |
| 75 | service(EventManager::SERVICE_ID), |
| 76 | ] |
| 77 | ); |
| 78 | |
| 79 | $services |
| 80 | ->set(InstanceCopier::class . '::TESTS', InstanceCopier::class) |
| 81 | ->args( |
| 82 | [ |
| 83 | service(InstanceMetadataCopier::class), |
| 84 | service(Ontology::SERVICE_ID) |
| 85 | ] |
| 86 | ) |
| 87 | ->call( |
| 88 | 'withInstanceContentCopier', |
| 89 | [ |
| 90 | service(TestContentCopier::class), |
| 91 | ] |
| 92 | ) |
| 93 | ->call( |
| 94 | 'withPermissionCopiers', |
| 95 | [ |
| 96 | tagged_iterator('tao.copier.permissions'), |
| 97 | ] |
| 98 | ) |
| 99 | ->call( |
| 100 | 'withEventManager', |
| 101 | [ |
| 102 | service(EventManager::class), |
| 103 | ] |
| 104 | ); |
| 105 | |
| 106 | $services |
| 107 | ->set(ClassCopier::class . '::TESTS', ClassCopier::class) |
| 108 | ->share(false) |
| 109 | ->args( |
| 110 | [ |
| 111 | service(RootClassesListService::class), |
| 112 | service(ClassMetadataCopier::class), |
| 113 | service(InstanceCopier::class . '::TESTS'), |
| 114 | service(ClassMetadataMapper::class), |
| 115 | service(Ontology::SERVICE_ID), |
| 116 | ] |
| 117 | ) |
| 118 | ->call( |
| 119 | 'withPermissionCopiers', |
| 120 | [ |
| 121 | tagged_iterator('tao.copier.permissions'), |
| 122 | ] |
| 123 | ); |
| 124 | |
| 125 | $services |
| 126 | ->set(TestClassCopier::class, TestClassCopier::class) |
| 127 | ->share(false) |
| 128 | ->args( |
| 129 | [ |
| 130 | service(ClassCopier::class . '::TESTS'), |
| 131 | service(Ontology::SERVICE_ID), |
| 132 | ] |
| 133 | ); |
| 134 | |
| 135 | $services |
| 136 | ->get(ClassCopierProxy::class) |
| 137 | ->call( |
| 138 | 'addClassCopier', |
| 139 | [ |
| 140 | TaoOntology::CLASS_URI_TEST, |
| 141 | service(TestClassCopier::class), |
| 142 | ] |
| 143 | ); |
| 144 | |
| 145 | $services |
| 146 | ->get(InstanceCopierProxy::class) |
| 147 | ->call( |
| 148 | 'addInstanceCopier', |
| 149 | [ |
| 150 | TaoOntology::CLASS_URI_TEST, |
| 151 | service(InstanceCopier::class . '::TESTS'), |
| 152 | ] |
| 153 | ); |
| 154 | } |
| 155 | } |