Newer
Older
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'AbstractControllerTestCase.php';
class OAIControllerListSetsTest extends AbstractControllerTestCase {
$catalogue_bd = Class_Catalogue::getLoader()->newInstanceWithId(1)
->setLibelle('BDs')
->setOaiSpec('livres:bd');
$catalogue_musique = Class_Catalogue::getLoader()->newInstanceWithId(2)
->setLibelle('Musique')
->setDescription('La musique qui balance')
->setOaiSpec('music');
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Catalogue')
->whenCalled('findAllBy')
->with(array('where' => 'oai_spec is not null',
'where' => 'oai_spec !=\'\'',
'order' => 'oai_spec'))
->answers(array($catalogue_bd, $catalogue_musique));
$this->dispatch('/opac/oai/request?verb=ListSets');
}
/** @test */
public function setMusiqueShouldContainSpecMusic() {
$this->_xpath->assertXpathContentContains($this->_response->getBody(),
'//oai:ListSets/oai:set/oai:setSpec',
'music');
}
/** @test */
public function setMusiqueShouldContainNameMusique() {
$this->_xpath->assertXpathContentContains($this->_response->getBody(),
'//oai:ListSets/oai:set/oai:setName',
'Musique');
}
public function setMusiqueShouldContainDescriptionLaMusiqueQuiBalance() {
$this->_xpath->assertXpathContentContains($this->_response->getBody(),
'//oai:ListSets/oai:set/oai:setDescription',
'La musique qui balance');
}
/** @test */
public function setBdsShouldContainsSpecLivresColonBds() {
$this->_xpath->assertXpathContentContains($this->_response->getBody(),
'//oai:ListSets/oai:set/oai:setSpec',
'livres:bd');
}
/** @test */
public function setBdsShouldContainsNameBds() {
$this->_xpath->assertXpathContentContains($this->_response->getBody(),
'//oai:ListSets/oai:set/oai:setName',
'BDs');
}
public function setBdsShouldNotContainDescription() {
$this->_xpath->assertNotXpath($this->_response->getBody(),
'//oai:ListSets/oai:set/oai:setSpec[text()="livres:bd"][following-sibling::oai:setDescription]');
}