public function test6() { $testProperty = new TestProperty(Constants::TEST_COUNT_DOCUMENTS); $extractionInfo = $this->arkivUtrekk->getExtractionInfo(); if ($this->numberOfDocumentsInDirectory != -1 && $this->numberOfDocumentsInDirectory == $extractionInfo->getAntallDokumentfiler()) { $testProperty->addTestResult(true); $testProperty->addTestResultDescription('Number of documents identified in ' . Constants::NAME_ARKIVUTTREKK_XML . 'is correct. Number identified is ' . $extractionInfo->getAntallDokumentfiler()); } else { $this->testProperty->addTestResult(false); $this->testProperty->addTestResultDescription('Number of documents identified in ' . Constants::NAME_ARKIVUTTREKK_XML . 'is in correct. Number identified is ' . $extractionInfo->getAntallDokumentfiler() . ' while number of documents found is ' . $this->numberOfDocumentsInDirectory); } $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A6); print $testProperty . PHP_EOL; }
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(''); }