ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
simple_test.php
Go to the documentation of this file.
1 <?php
2 #require_once '../src/LibRIS.php';
3 $testdir = 'tests';
4 
5 set_include_path(get_include_path() . PATH_SEPARATOR . './src/');
6 
7 spl_autoload_register(function ($klass) {
8  $parts = explode('\\', $klass);
9  if ($parts[0] == 'LibRIS') {
10  print "Called for $klass" . PHP_EOL;
11  include implode(DIRECTORY_SEPARATOR, $parts) . '.php';
12  }
13 });
14 
15 use \LibRIS\RISReader;
16 
17 $ris = new RISReader();
18 $ris->parseFile($testdir . '/derik-test.ris');
19 
20 $ris->printRecords();
21 
22 $records = $ris->getRecords();
23 
24  $rw = new \LibRIS\RISWriter();
25  print $rw->writeRecords($records);
26 
27 // Regression against Banyuls.ris
28 $ris = new RISReader();
29 $ris->parseFile($testdir . '/Banyuls.ris');
30 
31 $ris->printRecords();
32 
33 $records = $ris->getRecords();
34 
35 $rw = new \LibRIS\RISWriter();
36 print $rw->writeRecords($records);