Changeset 64 for php


Ignore:
Timestamp:
Aug 7, 2011, 4:18:58 PM (14 years ago)
Author:
cla
Message:

rdfint

  • added code to read list of RDF testcases from RDF data
  • TODO: execution of testcases!
Location:
php/trunk/unittest/rdftestcases
Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • php/trunk/unittest/rdftestcases/unittest.php

    r58 r64  
    2020// load library setup
    2121define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22define( 'FDEBUG_SESSION_NAME', 'RDF Test Cases Unittest');
    2223require_once( RDFINT.'/rdfa.php');
     24require_once( 'rdftestcases.php');
    2325
    2426class UnitTest extends PHPUnit_Framework_TestCase {
    2527
    26   static protected $baseuri;
    27   private $testcase;
    28   const BASEURI = 'http://www.w3.org/2000/10/rdf-tests/rdfcore';
     28  static protected $manifest;
    2929
    3030  // --------------------------------------------------------
    3131
     32  // rune once initializer
    3233  public static function setUpBeforeClass() {
    33     $testcase = trim( getenv( 'TESTCASE'));
    34     echo "Executing RDF testcase: $testcase\n\n";
     34    self::$manifest = new RDFTestCasesManifest;
    3535  }
    3636
    3737  // --------------------------------------------------------
    3838
    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
    4442  private function _refineResult( $data) {
    4543    // replace all blank nodes by one ID
     
    5755
    5856  // --------------------------------------------------------
    59 
     57  // helper: write input and output data to new output
     58  // directory for manual examination
    6059  private function _writeErrorData( $testcase,
    6160                                    $source, $sourceuri,
     
    7675  // --------------------------------------------------------
    7776
     77  // helper: serialize data from URI to N3
    7878  private function _getSerializedData( $uri) {
    7979
     
    8585  } // private function _getSerializedData
    8686
     87
    8788  // --------------------------------------------------------
    8889
    8990  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() {
    90114
    91115    // get testcase name again in object context
     
    113137    // in case of error, write serialized data to subdirectory
    114138    if (!$success)
    115       $this->_writeErrorData( $testcase, 
    116                               $source, $sourceuri, 
     139      $this->_writeErrorData( $testcase,
     140                              $source, $sourceuri,
    117141                              $result, $resulturi);
    118142
     
    123147  } // public function test_parse_sparql()
    124148
     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
    125163} // class UnitTest
    126164
Note: See TracChangeset for help on using the changeset viewer.