Changeset 64 for php/trunk/unittest/rdftestcases/unittest.php
- Timestamp:
- Aug 7, 2011, 4:18:58 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
php/trunk/unittest/rdftestcases/unittest.php
r58 r64 20 20 // load library setup 21 21 define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT')); 22 define( 'FDEBUG_SESSION_NAME', 'RDF Test Cases Unittest'); 22 23 require_once( RDFINT.'/rdfa.php'); 24 require_once( 'rdftestcases.php'); 23 25 24 26 class UnitTest extends PHPUnit_Framework_TestCase { 25 27 26 static protected $baseuri; 27 private $testcase; 28 const BASEURI = 'http://www.w3.org/2000/10/rdf-tests/rdfcore'; 28 static protected $manifest; 29 29 30 30 // -------------------------------------------------------- 31 31 32 // rune once initializer 32 33 public static function setUpBeforeClass() { 33 $testcase = trim( getenv( 'TESTCASE')); 34 echo "Executing RDF testcase: $testcase\n\n"; 34 self::$manifest = new RDFTestCasesManifest; 35 35 } 36 36 37 37 // -------------------------------------------------------- 38 38 39 protected function setUp() { 40 } 41 42 // -------------------------------------------------------- 43 39 // helper: adjusts serialization results so that comparison can work 40 // - make all blank node identifiers unique 41 // - sort the n-triple lines 44 42 private function _refineResult( $data) { 45 43 // replace all blank nodes by one ID … … 57 55 58 56 // -------------------------------------------------------- 59 57 // helper: write input and output data to new output 58 // directory for manual examination 60 59 private function _writeErrorData( $testcase, 61 60 $source, $sourceuri, … … 76 75 // -------------------------------------------------------- 77 76 77 // helper: serialize data from URI to N3 78 78 private function _getSerializedData( $uri) { 79 79 … … 85 85 } // private function _getSerializedData 86 86 87 87 88 // -------------------------------------------------------- 88 89 89 90 public function test() { 91 92 $type = trim( getenv( 'CATEGORY')); 93 if ($type == '') 94 $types = self::$manifest->getCategories(); 95 else 96 $types = array( $type); 97 98 foreach ($types as $type) { 99 echo "\nExecuting RDF Test Cases of category: $type\n\n"; 100 101 $testcases = self::$manifest->getParserTests( $type); 102 103 foreach ($testcases as $testcase) { 104 echo " Executing: " . $testcase->name . "\n"; 105 $this->assertEquals( 0, 0); 106 } 107 } 108 109 } // public function test 110 111 // -------------------------------------------------------- 112 113 public function disabled_test() { 90 114 91 115 // get testcase name again in object context … … 113 137 // in case of error, write serialized data to subdirectory 114 138 if (!$success) 115 $this->_writeErrorData( $testcase, 116 $source, $sourceuri, 139 $this->_writeErrorData( $testcase, 140 $source, $sourceuri, 117 141 $result, $resulturi); 118 142 … … 123 147 } // public function test_parse_sparql() 124 148 149 150 // -------------------------------------------------------- 151 152 public function _dumpTestcaseInfo( $testcases) { 153 foreach ($testcases as $testcase) { 154 echo "=====================================================================\n"; 155 echo 'URI: ' . $testcase->getSubject() . "\n"; 156 echo 'Input: ' . $testcase->input . "\n"; 157 echo 'Output: ' . $testcase->output . "\n"; 158 echo 'Concluision: ' . $testcase->conclusion . "\n"; 159 } 160 } 161 162 125 163 } // class UnitTest 126 164
Note:
See TracChangeset
for help on using the changeset viewer.