Permalink
Browse files

Updated unit tests.

  • Loading branch information...
1 parent 4ce0e57 commit 690fba9501e0f097b1e0bcafd357db18df51bf34 @technosophos committed Feb 3, 2012
Showing with 21 additions and 8 deletions.
  1. +21 −8 tests/simple_test.php
View
@@ -1,23 +1,36 @@
<?php
-require_once '../src/LibRIS.php';
+#require_once '../src/LibRIS.php';
+$testdir = 'tests';
-$ris = new LibRIS();
-$ris->parseFile('./derik-test.ris');
+set_include_path(get_include_path() . PATH_SEPARATOR . './src/');
+
+spl_autoload_register(function ($klass) {
+ $parts = explode('\\', $klass);
+ if ($parts[0] == 'LibRIS') {
+ print "Called for $klass" . PHP_EOL;
+ include implode(DIRECTORY_SEPARATOR, $parts) . '.php';
+ }
+});
+
+use \LibRIS\RISReader;
+
+$ris = new RISReader();
+$ris->parseFile($testdir . '/derik-test.ris');
$ris->printRecords();
$records = $ris->getRecords();
-$rw = new RISWriter();
+$rw = new \LibRIS\RISWriter();
print $rw->writeRecords($records);
// Regression against Banyuls.ris
-$ris = new LibRIS();
-$ris->parseFile('./Banyuls.ris');
+$ris = new RISReader();
+$ris->parseFile($testdir . '/Banyuls.ris');
$ris->printRecords();
$records = $ris->getRecords();
-$rw = new RISWriter();
-print $rw->writeRecords($records);
+$rw = new \LibRIS\RISWriter();
+print $rw->writeRecords($records);

0 comments on commit 690fba9

Please sign in to comment.