source: php/trunk/unittest/rdftestcases/unittest.php@ 17

Last change on this file since 17 was 17, checked in by cla, 14 years ago

rdfint

  • prefix non-standard methods of rdfa::Data and rdfa::Projection with underscore
  • add note to description of rdfa::SparlEndpoint and rdfa::SparlQuery that they are no-standard as well
  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1<?PHP
2
3/* RDFInt.php - RDF Interfaces for PHP
4 * Copyright 2011 netlabs.org
5 * Author: Christian Langanke, Adrian Gschwend
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20// load unittest setup
21require_once( '../unittest_config.php');
22
23class UnitTest extends PHPUnit_Framework_TestCase {
24
25 static protected $baseuri;
26 private $testcase;
27 const BASEURI = 'http://www.w3.org/2000/10/rdf-tests/rdfcore';
28
29 // --------------------------------------------------------
30
31 public static function setUpBeforeClass() {
32 $testcase = trim( getenv( 'TESTCASE'));
33 echo "Executing RDF testcase: $testcase\n\n";
34 }
35
36 // --------------------------------------------------------
37
38 protected function setUp() {
39 }
40
41 // --------------------------------------------------------
42
43 private function _getSerializedData( $uri) {
44
45 $rdfaData = new \rdfa\Data();
46 $this->assertInstanceOf( '\rdfa\Data', $rdfaData);
47 $rdfaData->parse( $uri);
48 return $rdfaData->_serialize( 'n3');
49
50 } // private function _getSerializedData
51
52 // --------------------------------------------------------
53
54 public function test() {
55
56 // get testcase name again in object context
57 $testcase = trim( getenv( 'TESTCASE'));
58 $this->assertGreaterThan( 0, strlen( $testcase));
59
60 // read source data
61 $source = $this->_getSerializedData( self::BASEURI."/$testcase.rdf");
62 $this->assertEquals( ($source !== false), true);
63
64 // read target data
65 $result = $this->_getSerializedData( self::BASEURI."/$testcase.nt");
66 $this->assertEquals( ($result !== false), true);
67
68 // compare source and target data
69 $this->assertEquals( ($source == $result), true);
70
71
72 } // public function test_parse_sparql()
73
74} // class UnitTest
75
76
Note: See TracBrowser for help on using the repository browser.