Skip to content
Snippets Groups Projects
Commit 384b31ee authored by llaffont's avatar llaffont
Browse files

Désactive les réponse OAI si module non activé

parent d749c358
Branches
Tags
No related merge requests found
......@@ -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',
......
......@@ -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;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment