From 0250c52fc623ad49f0cb392d13eb27b4cba84d82 Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@git-test.afi-sa.fr> Date: Mon, 10 Dec 2012 09:23:56 +0000 Subject: [PATCH] Gallica : validation XML test 11 --- .../Class/WebService/OAI/Request/ListIdentifiers.php | 5 +++++ .../controllers/OAIControllerListIdentifiersTest.php | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/library/Class/WebService/OAI/Request/ListIdentifiers.php b/library/Class/WebService/OAI/Request/ListIdentifiers.php index d2cc9416155..179fac72fa3 100644 --- a/library/Class/WebService/OAI/Request/ListIdentifiers.php +++ b/library/Class/WebService/OAI/Request/ListIdentifiers.php @@ -48,12 +48,17 @@ class Class_WebService_OAI_Request_ListIdentifiers { $this->_until = $this->_params['until']; $this->_resumptionToken = $this->_params['resumptionToken']; + if ($this->_resumptionToken && ($token = Class_WebService_OAI_ResumptionToken::find($this->_resumptionToken))) { $this->_set = $token->getParam('set'); $this->_from = $token->getParam('from'); $this->_until = $token->getParam('until'); } + if (!strtotime($this->_until)) + $this->_until = null; + if (!strtotime($this->_from)) + $this->_from = null; $this->_catalogue = $this->getCatalogueFromSetSpec($this->_set); } diff --git a/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php b/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php index 4dc5f167e01..e2b02352ea8 100644 --- a/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php +++ b/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php @@ -298,6 +298,16 @@ class OAIControllerListIdentifiersInvalidParamsTest extends AbstractControllerTe $this->_xpath->assertXPath($this->_response->getBody(), '//oai:error[@code="badResumptionToken"]'); } + + /** @test */ + public function withBadFromAndUntilResponseShouldNotContainsAttributes() { + $this->dispatch('/opac/oai/request?verb=ListIdentifiers&metadataPrefix=oai_dc&set=really_wrong_set&from=some_random_date&until=some_random_date'); + $this->_xpath->assertXPath($this->_response->getBody(), + '//oai:request[not(@from)][not(@until)]'); + + } + + } -- GitLab