Ejemplo n.º 1
0
 public function test3()
 {
     print 'Testing documents in arkivstruktur.xml ' . PHP_EOL;
     $akivstrukturParser = new ArkivstrukturParser($this->directory, $this->documentListHandler, $this->testResultsHandler, false);
     $parser = xml_parser_create('UTF-8');
     xml_set_object($parser, $akivstrukturParser);
     // XML_OPTION_CASE_FOLDING Do not fold element names to upper case
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
     // set function names to handle start / end tags of elements and to parse content between tags
     xml_set_element_handler($parser, "startElement", "endElement");
     xml_set_character_data_handler($parser, "cdata");
     $arkivstrukturFile = fopen(join(DIRECTORY_SEPARATOR, array($this->directory, $this->arkivstrukturFilename)), 'r');
     while ($data = fread($arkivstrukturFile, 4096)) {
         xml_parse($parser, $data, feof($arkivstrukturFile));
         flush();
     }
     fclose($arkivstrukturFile);
     xml_parser_free($parser);
     $this->numberOfDocumentsProcessed = $akivstrukturParser->getNumberOfDocumentsProcessed();
     $this->numberOfFileProcessed = $akivstrukturParser->getNumberOfFileProcessed();
     $this->numberOfRegistryEntryProcessed = $akivstrukturParser->getNumberOfRegistryEntryProcessed();
     $arkivstrukturData = $this->arkivUtrekk->getArkivstruktur();
     $numberOfFileReportedInArkivUttrekk = $arkivstrukturData->getNumberMappe();
     $numberOfRegistryEntryReportedInArkivUttrekk = $arkivstrukturData->getNumberRegistrering();
     $numberOfDocumentsReportedInArkivUttrekk = $this->arkivUtrekk->getExtractionInfo()->getAntallDokumentfiler();
     $testProperty = new TestProperty(Constants::TEST_COUNT_MAPPE);
     $documentDirectoryTest = new CheckNumberObjectsArkivutrekk(Constants::TEST_COUNT_MAPPE, $numberOfFileReportedInArkivUttrekk, $this->numberOfFileProcessed, Constants::NAME_ARKIVSTRUKTUR_XML, 'mappe', $testProperty);
     $documentDirectoryTest->runTest();
     $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A7);
     print $testProperty . PHP_EOL;
     $testProperty = new TestProperty(Constants::TEST_COUNT_REGISTRERING);
     $documentDirectoryTest = new CheckNumberObjectsArkivutrekk(Constants::TEST_COUNT_REGISTRERING, $numberOfRegistryEntryReportedInArkivUttrekk, $this->numberOfRegistryEntryProcessed, Constants::NAME_ARKIVSTRUKTUR_XML, 'registrering', $testProperty);
     $documentDirectoryTest->runTest();
     $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A8);
     print $testProperty . PHP_EOL;
     $testProperty = new TestProperty(Constants::TEST_COUNT_DOCUMENTS_ACTUAL);
     $documentDirectoryTest = new CheckNumberObjectsArkivutrekk(Constants::TEST_COUNT_DOCUMENTS_ACTUAL, $numberOfDocumentsReportedInArkivUttrekk, $this->numberOfDocumentsProcessed, Constants::NAME_ARKIVSTRUKTUR_XML, 'dokument', $testProperty);
     $documentDirectoryTest->runTest();
     $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A5);
     print $testProperty . PHP_EOL;
 }
Ejemplo n.º 2
0
 public function testA8()
 {
     $this->logger->info('START test A8 : Crossreference number of <registrering> against value in arkivuttrekk.xml');
     $testProperty = new TestProperty(Constants::TEST_COUNT_MAPPE_ARKIVUTTREKK);
     try {
         if ($this->statistics === null) {
             $this->parseArkivstruktur();
         }
         $arkivstrukturInfo = $this->arkivUttrekkDetails->getArkivstruktur();
         $numberOfRegistrationReportedInArkivUttrekk = $arkivstrukturInfo->getNumberRegistrering();
         $documentDirectoryTest = new CheckNumberObjectsArkivutrekk(Constants::TEST_COUNT_MAPPE_ARKIVUTTREKK, $numberOfRegistrationReportedInArkivUttrekk, $this->statistics->getNumberOfRecordProcessed(), Constants::NAME_ARKIVSTRUKTUR_XML, 'registrering', $testProperty);
         $documentDirectoryTest->runTest();
         if ($testProperty->getTestResult() == true) {
             $this->logger->info(' RESULT The number of registrering in arkivstruktur.xml (' . $this->statistics->getNumberOfRecordProcessed() . ') equals the number in arkivuttrekk.xml (' . $numberOfRegistrationReportedInArkivUttrekk . ')');
         } else {
             $this->logger->error(' RESULT The number of registrering in arkivstruktur.xml (' . $this->statistics->getNumberOfRecordProcessed() . ') does not equal the number in arkivuttrekk.xml (' . $numberOfRegistrationReportedInArkivUttrekk . ')');
         }
         $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A8);
     } catch (Exception $e) {
         $this->logger->error("Error when attempting test " . $testProperty->getDescription() . ". The following exception occured " . $e);
     }
     $this->logger->info('END test A8');
     $this->logger->info('');
 }