diff --git a/models/classes/class.QtiTestService.php b/models/classes/class.QtiTestService.php index eef7640e2..c5dc56eec 100644 --- a/models/classes/class.QtiTestService.php +++ b/models/classes/class.QtiTestService.php @@ -812,7 +812,10 @@ protected function importTest( // Metadata will be set as property values. $this->getMetadataImporter()->inject($qtiTestResource->getIdentifier(), $testResource); //todo: fix taoSetup to be aware of containers. This is only workaround. - if ($this->getServiceManager()->getContainer()->has(MappedMetadataInjector::class)) { + if ( + $this->getServiceManager()->getContainer()->has(MappedMetadataInjector::class) + && $importMetadata + ) { $this->getServiceManager()->getContainer()->get(MappedMetadataInjector::class)->inject( $mappedProperties['testProperties'] ?? [], $metadataValues[$qtiTestResourceIdentifier] ?? [],