Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
add services test #2
Browse files Browse the repository at this point in the history
  • Loading branch information
mshd committed Jun 9, 2020
1 parent edcd064 commit 08eed56
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/CatalogMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ private function parseSingleRecord(array $title)

//format price
if (array_key_exists('price', $result)) {
error_log($result["price"][0]);

$ll = explode(':', $result['price'][0]);
if (count($ll) > 1) {
Expand Down
42 changes: 42 additions & 0 deletions tests/TestAllServices.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
use PHPUnit\Framework\TestCase;
use Libreja\SruCatalog\CatalogMain;

class TestAllServices extends TestCase
{
// public function testExpectFooActualFoo()
// {
// $this->expectOutputString('foo');
// print 'foo';
// }

public function testCheckServices()
{
$sruCatalog = new CatalogMain();
$sruCatalog->service = "gvk";
$fetch = $sruCatalog->parse([
"isxn" => '9780553375404',
]);
$book1 = $fetch["records"][0];
$this->assertEquals(263, $book1["numberOfPages"]);
$this->assertEquals("Quinn, Daniel", $book1["author"]);
$this->assertEquals("Bantam Books", $book1["publisher"]);


$sruCatalog->service = "dnb";
$fetch = $sruCatalog->parse([
"title" => 'Der Richter und sein Henker',
"year" => '1985',
"publisher" => 'Reclam',
"author" => 'Dürrenmatt',
]);
$book2 = $fetch["records"][0];
$this->assertEquals(1, $fetch["numberOfRecords"]);

$this->assertEquals("1985-00-00", $book2["datePublished"]);
$this->assertEquals("Leipzig", $book2["publisherPlace"]);
$this->assertEquals("ger", $book2["inLanguage"]);

// $this->expectOutputString('bar');
}
}

0 comments on commit 08eed56

Please sign in to comment.