Пример #1
0
                fwrite($fDebugLog, display_xml_error($error));
            }
            libxml_clear_errors();
        }
    }
    // END if (0 < $nXmlWellFormedError )
    ## END well-formed errors? ##
}
// END IF (true)
### Test validation
if ($bArrCustom[2]) {
    $thisTestNameValidation = 'Validation test';
    $thisDirectory = $strDatasetDir;
    $thisFilename = $filenameXmlReaderIn;
    $thisFilenameValidate = $filenameXmlValidate;
    $thisXMLValidationTestProperty = new XMLValidationTestProperty(Constants::TEST_XMLTEST_VALIDATION_VALID);
    print ' ##############' . PHP_EOL . PHP_EOL;
    $strTemp = implode('/', array($thisDirectory, $thisFilename));
    print $strTemp . PHP_EOL;
    $thisXMLTestValidation = new XMLTestValidation($thisTestNameValidation, $thisDirectory, $thisFilename, $thisFilenameValidate, $thisXMLValidationTestProperty);
    $thisXMLTestValidation->runTest();
    // Log XML Reader in description report
    $strDescription = $thisXMLValidationTestProperty->getDescriptionReport() . PHP_EOL;
    $strLine = '';
    logLog(0, $strDescription, $strLine, 2);
    // Log XML Reader in description
    $strDescription = $thisXMLValidationTestProperty->getDescription() . PHP_EOL;
    $strLine = '';
    logLog(0, $strDescription, $strLine, 2);
    ## validate errors? ##
    $nXmlValidateError = count(libxml_get_errors());
Пример #2
0
 public function testA1()
 {
     $this->logger->info('START test A1 : XML files are wellformed and valid');
     try {
         $this->logger->info('  Testing all XML/XSD files for well-formedness');
         foreach ($this->standardExtractionContents->directoryContents->file as $file) {
             $xmlValidationTestProperty = new XMLWellFormedTestProperty(Constants::TEST_XMLTEST_VALIDATION_WELLFORMED);
             $xmlTestWellFormed = new XMLTestWellFormed(Constants::TEST_XMLTEST_VALIDATION_WELLFORMED, $this->directory, $file->filename, $xmlValidationTestProperty);
             $xmlTestWellFormed->runTest();
             if ($xmlValidationTestProperty->getTestResult() == false) {
                 $this->testProperty->setTestResult(false);
             }
             $this->testResultsHandler->addResult($xmlValidationTestProperty, Constants::TEST_TYPE_A1);
             $xmlTestWellFormed = null;
         }
         $this->logger->info('  Testing all XML files for validity');
         foreach ($this->standardExtractionContents->filesToValidate->file as $file) {
             $testProperty = new XMLValidationTestProperty(Constants::TEST_XMLTEST_VALIDATION_VALID);
             $xmlTestValidation = new XMLTestValidation(Constants::TEST_XMLTEST_VALIDATION_VALID, $this->directory, $file->filename, $file->validatedBy, $testProperty);
             $xmlTestValidation->runTest();
             if ($testProperty->getTestResult() == false) {
                 $this->testProperty->setTestResult(false);
             }
             $this->testResultsHandler->addResult($testProperty, Constants::TEST_TYPE_A1);
             $xmlTestValidation = null;
         }
     } catch (Exception $e) {
         $this->logger->error("Error when attempting test A1. The following exception occured " . $e);
     }
     $this->logger->info('END test A1');
     $this->logger->info('');
 }