From 0b0875d69fd09e83c15ab0b825e285cbcbe45e3b Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Mon, 10 Dec 2012 08:33:08 +0000 Subject: [PATCH] =?UTF-8?q?Correction=20erreurs=20OAI=20conformit=C3=A9=20?= =?UTF-8?q?http://re.cs.uct.ac.za?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OAI/Request/ListIdentifiers.php | 3 --- .../OAIControllerListRecordsTest.php | 19 -------------- .../opac/controllers/OAIControllerTest.php | 25 ++++++++++++++++--- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/library/Class/WebService/OAI/Request/ListIdentifiers.php b/library/Class/WebService/OAI/Request/ListIdentifiers.php index c67547f8568..fdcae99ca95 100644 --- a/library/Class/WebService/OAI/Request/ListIdentifiers.php +++ b/library/Class/WebService/OAI/Request/ListIdentifiers.php @@ -68,9 +68,6 @@ class Class_WebService_OAI_Request_ListIdentifiers { if ('oai_dc' != $this->_metadataPrefix) return $builder->error(array('code' => 'cannotDisseminateFormat')); - if (!$this->_set) - return $builder->error(array('code' => 'noRecordsMatch')); - if ($this->_set && !$this->_catalogue) return $builder->error(array('code' => 'badArgument'), 'Set not found'); diff --git a/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php b/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php index a2b2492d3df..4d6804ef4ad 100644 --- a/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php +++ b/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php @@ -99,23 +99,4 @@ class OAIControllerListRecordsInZorkSetTest extends AbstractControllerTestCase { } } - -class OAIControllerListRecordsWithoutSetTest extends AbstractControllerTestCase { - protected $_xpath; - protected $_xml; - - public function setUp() { - parent::setUp(); - $this->_xpath = TestXPathFactory::newOaiDc(); - $this->dispatch('/opac/oai/request?verb=ListRecords&metadataPrefix=oai_dc'); - $this->_xml = $this->_response->getBody(); - } - - - /** @test */ - public function shouldHaveNoRecordsError() { - $this->_xpath->assertXPath($this->_xml, '//oai:error[@code="noRecordsMatch"]'); - } -} - ?> \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/OAIControllerTest.php b/tests/application/modules/opac/controllers/OAIControllerTest.php index 0b14ae42e93..d8e124c54f3 100644 --- a/tests/application/modules/opac/controllers/OAIControllerTest.php +++ b/tests/application/modules/opac/controllers/OAIControllerTest.php @@ -57,19 +57,38 @@ abstract class OAIControllerRequestTestCase extends AbstractControllerTestCase { class OAIControllerIndentifyRequestTest extends OaiControllerRequestTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/oai/request?verb=Identify', true); + } + + /** @test */ - public function shouldReturnIdentifyResponseWithoutError() { - $this->dispatch('/opac/oai/request?verb=Identify', true); + public function shouldReturnIdentifyResponse() { $this->_xpath->assertXPath($this->_response->getBody(), '//oai:request[@verb="Identify"]'); + } + + + /** @test */ + public function responseShouldNotHaveError() { $this->_xpath->assertNotXPath($this->_response->getBody(), '//oai:error'); } +} + + + + +class OAIControllerIndentifyRequestWithIllegalParameterTest extends OaiControllerRequestTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/oai/request?verb=Identify&test=test', true); + } /** @test */ public function shouldReturnErrorBadArgumentWithIllegalParameter() { - $this->dispatch('/opac/oai/request?verb=Identify&test=test', true); $this->_xpath->assertXPath($this->_response->getBody(), '//oai:error[@code="badArgument"]'); } -- GitLab