Skip to content
Snippets Groups Projects
Commit a3446d92 authored by Julian Maurice's avatar Julian Maurice
Browse files

hotline #13167 Add tests for Class_WebService_OPDS_CatalogReader

parent 8b197233
Branches
Tags
6 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!78Master,!77Hotline 6.41,!70Hotline/13167,!69Hotline/13167,!67Hotline/13167
<?php
class OPDS_CatalogReaderTest extends PHPUnit_Framework_TestCase {
protected $catalog_reader;
public function setUp() {
$xmlpath = realpath(dirname(__FILE__)) . '/fixtures/atramenta.xml';
$xml = file_get_contents($xmlpath);
$this->catalog_reader = Class_WebService_OPDS_CatalogReader::fromXML($xml);
}
/** @test */
public function catalogReaderEntriesShouldHaveCorrectLink() {
$entries = $this->catalog_reader->getEntries();
$this->assertEquals('http://www.atramenta.net/opds/lecture_libre.atom', $entries[0]->getLink());
$this->assertEquals('https://www.atramenta.net/opds/account.atom', $entries[1]->getLink());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:app="http://www.w3.org/2007/app" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opds="http://opds-spec.org/2010/catalog" xml:lang="en" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns="http://www.w3.org/2005/Atom">
<id>http://www.atramenta.net/opds/catalog.atom</id>
<link type="application/atom+xml" href="http://www.atramenta.net/opds/catalog.atom" rel="self"/>
<title>Atramenta</title>
<updated>2014-04-23T11:29:28+02:00</updated>
<icon>http://www.atramenta.net/favicon.ico</icon>
<author>
<name>Atramenta</name>
<uri>http://www.atramenta.net</uri>
<email>noreply@atramenta.net</email>
</author>
<link type="application/atom+xml; profile=opds-catalog; kind=navigation" href="http://www.atramenta.net/opds/catalog.atom" rel="self"/>
<entry>
<title>Lecture libre</title>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" href="http://www.atramenta.net/opds/lecture_libre.atom" rel="subsection"/>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" href="http://www.atramenta.net/opds/catalog.atom" rel="start" title="Atramenta"/>
<updated>2014-04-23T11:29:28+02:00</updated>
<id>http://www.atramenta.net/opds/lecture_libre.atom</id>
<content type="text">Des milliers d'oeuvres du domaine public et d'auteurs contemporains à télécharger gratuitement</content>
</entry>
<entry>
<title>Mon compte</title>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" href="https://www.atramenta.net/opds/account.atom" rel="subsection"/>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" href="http://www.atramenta.net/opds/catalog.atom" rel="start" title="Atramenta"/>
<updated>2014-04-23T11:29:28+02:00</updated>
<id>https://www.atramenta.net/opds/account.atom</id>
<content type="text">Vos oeuvres favorites et vos propres oeuvres et ebooks</content>
</entry>
</feed>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment