Skip to content
Snippets Groups Projects
Commit 5bdfaa35 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch 'hotline#47505_integration_des_ressources_jumel_correctifs' into 'hotline-master'

hotline #47505 : CDScript consult link: with no identity, consult link is ajax-login

See merge request !1995
parents d5d18a4b 9c5fe758
3 merge requests!2080Sandbox detach zf from storm,!2061Master,!1995hotline #47505 : CDScript consult link: with no identity, consult link is ajax-login
Pipeline #310 passed with stage
in 8 minutes and 27 seconds
- ticket #47505 : Ressources CDScript : le lien de consultation dans la table des exemplaires ouvre une popup d'authentification lorsque l'utilisateur n'est pas connecté
\ No newline at end of file
......@@ -24,8 +24,7 @@ class Class_WebService_SIGB_CdScript {
protected static $service;
public static function getService($params){
if (!isset(static::$service)) {
if (!static::$service) {
$instance = new static();
$classname = get_called_class().'_Service';
static::$service = $classname::getService($params['server_url'],
......@@ -35,5 +34,9 @@ class Class_WebService_SIGB_CdScript {
return static::$service;
}
public static function resetService() {
static::$service = null;
}
}
?>
\ No newline at end of file
......@@ -67,7 +67,8 @@ class Class_Webservice_SIGB_CdScript_Service extends Class_WebService_SIGB_Abstr
return '';
if(!$user = Class_Users::getIdentity())
return '';
return Class_Url::assemble(['controller' => 'auth',
'action' => 'ajax-login']);
$data = array_merge($this->getRemoteLibraryId(),
['res' => $item->getSubfield('b'),
......
......@@ -20,31 +20,14 @@
*/
class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase {
abstract class NoticeAjaxControllerCdScriptRecordTestCase extends AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_record_le_kiosque,
$_item_le_kiosque,
$_service,
$_sigb_le_kiosque,
$_paul;
$_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_paul = $this->fixture('Class_Users',
['id' => 15,
'login' => 'paul',
'nom' => 'Le Pollux',
'prenom' => 'Paul',
'id_sigb' => '654987',
'idabon' => '23901000323008',
'mail' => 'anemail@web.com',
'naissance' => '2002-12-14',
'password' => 'pollux',
'date_fin' => '2015-12-14']);
ZendAfi_Auth::getInstance()->logUser($this->_paul);
ZendAfi_Auth::getInstance()->clearIdentity();
$config = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray();
$config['exemplaires']['grouper'] = '1';
......@@ -59,7 +42,7 @@ class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase
['id' => 3,
'libelle' => 'Le kiosque library']);
$this->_item_le_kiosque = $this->fixture('Class_Exemplaire',
$item_le_kiosque = $this->fixture('Class_Exemplaire',
['id' => 1,
'code_barres' => '456789',
'id_origine' => '456789',
......@@ -69,15 +52,60 @@ class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase
'cote' => '',
'zone995' => 'a:3:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:10:"Le Kiosque";}i:1;a:2:{s:4:"code";s:1:"b";s:6:"valeur";s:3:"kio";}i:2;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:3:"319";}}']);
$this->_record_le_kiosque = $this->fixture('Class_Notice',
['id' => 2,
'exemplaires' => [$this->_item_le_kiosque]]);
$this->fixture('Class_Notice',
['id' => 2,
'exemplaires' => [$item_le_kiosque]]);
Class_WebService_SIGB_CdScript
::getService(['server_url' => 'www.jumel39.fr/docnum.php',
'remote_library_id' => 2])
->setTimeSource(new TimeSourceForTest('2015-10-28 09:00:00'));
}
public function tearDown() {
Class_WebService_SIGB_CdScript::resetService();
parent::tearDown();
}
}
$this->_service = Class_WebService_SIGB_CdScript::getService(['server_url' => 'www.jumel39.fr/docnum.php',
'remote_library_id' => 2]);
$this->_service->setTimeSource(new TimeSourceForTest('2015-10-28 09:00:00'));
$this->_sigb_le_kiosque = $this->_service->getNotice('456789')->getExemplaireByCodeBarre('456789');
class NoticeAjaxControllerCdScriptRecordWithoutLoginTest extends NoticeAjaxControllerCdScriptRecordTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/noticeajax/exemplaires/id_notice/2', true);
}
/** @test */
public function availabilityShouldContainsLinkToAjaxLogin() {
$this->assertXPathContentContains('//table//td/a[contains(@href, "auth/ajax-login")]',
'Description en ligne',
$this->_response->getBody());
}
}
class NoticeAjaxControllerCdScriptRecordAsPaulTest extends NoticeAjaxControllerCdScriptRecordTestCase {
public function setUp() {
parent::setUp();
$paul = $this->fixture('Class_Users',
['id' => 15,
'login' => 'paul',
'nom' => 'Le Pollux',
'prenom' => 'Paul',
'id_sigb' => '654987',
'idabon' => '23901000323008',
'mail' => 'anemail@web.com',
'naissance' => '2002-12-14',
'password' => 'pollux',
'date_fin' => '2015-12-14']);
ZendAfi_Auth::getInstance()->logUser($paul);
$this->dispatch('/opac/noticeajax/exemplaires/id_notice/2', true);
}
......
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