public function testA10() { $this->logger->info('START test A10: number of documents specified in arkivuttrekk.xml is correct with count of documents in the dokumenter folder'); try { $testProperty = new TestProperty(Constants::TEST_COUNT_DOCUMENTS_ARKIVUTTREKK); $extractionInfo = $this->arkivUttrekkDetails->getExtractionInfo(); $documentDirectory = join(DIRECTORY_SEPARATOR, array($this->directory, Constants::NAME_DOCUMENT_DIRECTORY)); $dokumenterFolderCounter = new DokumenterFolderCounter($documentDirectory, Constants::MAX_RECURSIVE_DEPTH); $dokumenterFolderCounter->process(); $numberOfDocumentsInDirectory = $dokumenterFolderCounter->getNumberOfFiles(); if ($numberOfDocumentsInDirectory == $extractionInfo->getAntallDokumentfiler()) { $testProperty->addTestResult(true); $testProperty->addTestResultDescription('Number of documents identified in ' . Constants::NAME_ARKIVUTTREKK_XML . ' is correct. Number identified is ' . $extractionInfo->getAntallDokumentfiler()); $this->logger->info(' RESULT Number of documents identified in ' . Constants::NAME_ARKIVUTTREKK_XML . ' is correct. Number identified is (' . $extractionInfo->getAntallDokumentfiler() . '), while number of documents found is (' . $numberOfDocumentsInDirectory . ')'); } else { $this->testProperty->addTestResult(false); $this->testProperty->addTestResultDescription('Number of documents identified in ' . Constants::NAME_ARKIVUTTREKK_XML . ' is incorrect. Number identified is (' . $extractionInfo->getAntallDokumentfiler() . '), while number of documents found is (' . $numberOfDocumentsInDirectory . ')'); $this->logger->error(' RESULT Number of documents identified in ' . Constants::NAME_ARKIVUTTREKK_XML . ' is incorrect. Number identified is (' . $extractionInfo->getAntallDokumentfiler() . '), while number of documents found is (' . $numberOfDocumentsInDirectory . ')'); } $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A6); } catch (Exception $e) { $this->logger->error("Error when attempting test " . $testProperty->getDescription() . ". The following exception occured " . $e); } $this->logger->info('END test A10'); $this->logger->info(''); }
protected function getInfoDetails($dataObject) { /* * <dataObject name="Noark 5 arkivuttrekk"> * <properties> * <property name="info"> * <properties> * <property name="additionalInfo"> * * ... There are more objects in here that can be stored in ExtractionInfo ... * ... Just picking up antalldokumenter at the moment ... * <properties> * <property dataType="integer" name="antallDokumentfiler"> * <value>4</value> * */ $extractionInfo = new ArkivuttrekkExtractionInfo(); $attributeObject = $dataObject->attributes(); if (isset($attributeObject['name']) == true) { $extractionInfo->setDescription($attributeObject['name']); } else { $extractionInfo->setDescription(null); } foreach ($dataObject->properties->property->properties->property as $property) { $propertyAttributes = $property->attributes(); if (isset($propertyAttributes['name']) == true && strcasecmp($propertyAttributes['name'], 'type') == 0) { $extractionInfo->setType($property->value); $extractionInfo->setVersion($property->properties->property->value); } elseif (isset($propertyAttributes['name']) == true && strcasecmp($propertyAttributes['name'], 'additionalInfo') == 0) { foreach ($property->properties->property as $periodeInfo) { $periodeInfoAttributes = $periodeInfo->attributes(); if (isset($periodeInfoAttributes['name']) == true && strcasecmp($periodeInfoAttributes['name'], 'periode') == 0) { $periodeInfoInAndOut = $periodeInfo->properties->property; foreach ($periodeInfoInAndOut as $periodeInfoInAndOutProperty) { $periodeInfoInAndOutPropertyAttributes = $periodeInfoInAndOutProperty->attributes(); if (isset($periodeInfoInAndOutPropertyAttributes['name']) == true && strcasecmp($periodeInfoInAndOutPropertyAttributes['name'], 'inngaaendeSkille') == 0) { $periodeInfoIngaaende = $periodeInfoInAndOutProperty->value; $extractionInfo->setInngaaendeSkille($periodeInfoIngaaende); } elseif (isset($periodeInfoInAndOutPropertyAttributes['name']) == true && strcasecmp($periodeInfoInAndOutPropertyAttributes['name'], 'utgaaendeSkille') == 0) { $periodeInfoUtgaaende = $periodeInfoInAndOutProperty->value; $extractionInfo->setUtgaaendeSkille($periodeInfoUtgaaende); } // elseif } // foreach ($periodeInfoInAndOut as $periodeInfoInAndOutProperty ) { } elseif (isset($periodeInfoAttributes['name']) == true && strcasecmp($periodeInfoAttributes['name'], 'inneholderSkjermetInformasjon') == 0) { if (strcasecmp($periodeInfo->value, 'true') == 0) { $extractionInfo->setInneholderSkjermetInformasjon(true); } elseif (strcasecmp($periodeInfo->value, 'false') == 0) { $extractionInfo->setInneholderSkjermetInformasjon(false); } } elseif (isset($periodeInfoAttributes['name']) == true && strcasecmp($periodeInfoAttributes['name'], 'omfatterDokumenterSomErKassert') == 0) { if (strcasecmp($periodeInfo->value, 'true') == 0) { $extractionInfo->setOmfatterDokumenterSomErKassert(true); } elseif (strcasecmp($periodeInfo->value, 'false') == 0) { $extractionInfo->setOmfatterDokumenterSomErKassert(false); } } elseif (isset($periodeInfoAttributes['name']) == true && strcasecmp($periodeInfoAttributes['name'], 'inneholderDokumenterSomSkalKasseres') == 0) { if (strcasecmp($periodeInfo->value, 'true') == 0) { $extractionInfo->setInneholderDokumenterSomSkalKasseres(true); } elseif (strcasecmp($periodeInfo->value, 'false') == 0) { $extractionInfo->setInneholderDokumenterSomSkalKasseres(false); } } elseif (isset($periodeInfoAttributes['name']) == true && strcasecmp($periodeInfoAttributes['name'], 'inneholderVirksomhetsspesifikkeMetadata') == 0) { if (strcasecmp($periodeInfo->value, 'true') == 0) { $extractionInfo->setInneholderVirksomhetsspesifikkeMetadata(true); } elseif (strcasecmp($periodeInfo->value, 'false') == 0) { $extractionInfo->setInneholderVirksomhetsspesifikkeMetadata(false); } } elseif (isset($periodeInfoAttributes['name']) == true && strcasecmp($periodeInfoAttributes['name'], 'antallDokumentfiler') == 0) { $extractionInfo->setAntallDokumentfiler($periodeInfo->value); } } // foreach } // elseif (isset( } // foreach ( $this->arkivUttrekkDetails->setExtractionInfo($extractionInfo); }