diff --git a/library/Class/WebService/OAI/Request/ListIdentifiers.php b/library/Class/WebService/OAI/Request/ListIdentifiers.php index 6ed67385d10bc0e74cb65e8101c68c4d46353067..95066d53f327f809d12b2b93405bd39eaeb847b8 100644 --- a/library/Class/WebService/OAI/Request/ListIdentifiers.php +++ b/library/Class/WebService/OAI/Request/ListIdentifiers.php @@ -35,7 +35,7 @@ class Class_WebService_OAI_Request_ListIdentifiers { public function __construct($params, $baseUrl) { $this->_baseUrl = $baseUrl; - $this->_params = array_merge(array('metadataPrefix' => 'oai_dc', + $this->_params = array_merge(array('metadataPrefix' => null, 'set' => null, 'from' => null, 'until' => null, @@ -75,18 +75,23 @@ class Class_WebService_OAI_Request_ListIdentifiers { public function getErrorOn($builder) { + $answer = ''; + if (null == $this->_metadataPrefix) + $answer.=$builder->error(array('code' => 'badArgument'), 'Set not found'); + if ('oai_dc' != $this->_metadataPrefix) $answer .= $builder->error(array('code' => 'cannotDisseminateFormat')); + if ($this->_set && !$this->_catalogue) $answer .= $builder->error(array('code' => 'badArgument'), 'Set not found'); if ($this->_until && $this->_from) { if (strlen($this->_until) != strlen($this->_from)) - return $builder->error(array('code' => 'badArgument'), 'Set not found'); + return $builder->error(array('code' => 'badArgument'), 'from granularity != until granularity'); } $token = null; diff --git a/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php b/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php index 08c0af8ce12bc85a7b814d003604cd7b259765aa..5d8f8b38f2fcaa31067fbb6f7d656f942e8a588a 100644 --- a/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php +++ b/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php @@ -315,6 +315,14 @@ class OAIControllerListIdentifiersInvalidParamsTest extends AbstractControllerTe $this->_xpath->assertXPath($this->_response->getBody(), '//oai:error[@code="badArgument"]'); } + + /** @test */ + public function withListIdentifiersWithoutMetadataPrefixResponseShouldResponseBadArgument() { + $this->dispatch('opac/oai/request?verb=ListIdentifiers'); + $this->_xpath->assertXPath($this->_response->getBody(), + '//oai:error[@code="badArgument"]'); + + } }