From 384b31ee5d63a4f4fc0f64d020ed082c0eb5cd41 Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Fri, 4 May 2012 16:56:34 +0000 Subject: [PATCH] =?UTF-8?q?De=CC=81sactive=20les=20re=CC=81ponse=20OAI=20s?= =?UTF-8?q?i=20module=20non=20active=CC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/opac/controllers/OaiController.php | 2 ++ .../opac/controllers/OAIControllerTest.php | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/application/modules/opac/controllers/OaiController.php b/application/modules/opac/controllers/OaiController.php index e73471db088..f3f0e2df2a1 100644 --- a/application/modules/opac/controllers/OaiController.php +++ b/application/modules/opac/controllers/OaiController.php @@ -35,6 +35,8 @@ class OaiController extends Zend_Controller_Action { public function requestAction() { $this->getResponse()->setHeader('Content-Type', 'text/xml;charset=utf-8'); $this->getHelper('ViewRenderer')->setNoRender(); + if (!Class_AdminVar::isOAIServerEnabled()) + return; $verbsMapping = array('ListIdentifiers' => 'list-identifiers', 'Identify' => 'identify', diff --git a/tests/application/modules/opac/controllers/OAIControllerTest.php b/tests/application/modules/opac/controllers/OAIControllerTest.php index 3ab63863710..06006fc3202 100644 --- a/tests/application/modules/opac/controllers/OAIControllerTest.php +++ b/tests/application/modules/opac/controllers/OAIControllerTest.php @@ -25,6 +25,11 @@ abstract class OAIControllerRequestTestCase extends AbstractControllerTestCase { public function setUp() { parent::setUp(); + + Class_AdminVar::getLoader() + ->newInstanceWithId('OAI_SERVER') + ->setValeur('1'); + $this->_xpath = new Storm_Test_XPathXML(); $this->_xpath->registerNameSpace('oai', 'http://www.openarchives.org/OAI/2.0/'); } @@ -70,6 +75,19 @@ class OAIControllerIndentifyRequestTest extends OaiControllerRequestTestCase { +class OAIControllerRequestWithoutOAIEnabledTest extends AbstractControllerTestCase { + /** @test */ + public function responseShouldBeEmpty() { + Class_AdminVar::getLoader() + ->newInstanceWithId('OAI_SERVER') + ->setValeur('0'); + $this->dispatch('/opac/oai/request?verb=Identify'); + $this->assertEmpty($this->_response->getBody()); + } +} + + + class OaiControllerListSetsRequestTest extends OaiControllerRequestTestCase { protected $_xpath; -- GitLab