Newer
Older
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'AbstractControllerTestCase.php';
/** @see http://forge.afi-sa.fr/issues/21462 */
abstract class NoticeAjaxControllerPergameItemTestCase extends AbstractControllerTestCase {
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
public function setUp() {
parent::setUp();
$this->fixture('Class_IntBib', ['id' => 1,
'nom' => 'Site principal',
'nom_court' => 'limours',
'sigb' => Class_IntBib::COM_PERGAME,
'comm_sigb' => Class_IntBib::COM_PERGAME,
'comm_params' => 'a:3:{s:26:"Autoriser_docs_disponibles";s:0:"";s:13:"Max_par_carte";s:1:"4";s:16:"Max_par_document";s:3:"100";}']);
$this->fixture('Class_Notice', ['id' => 23,
'cle_oeuvre' => 'DDD']);
$this->fixture('Class_Exemplaire', ['id' => 732494,
'id_notice' => 23,
'id_bib' => 1,
'code_barres' => '0213689147',
'cote' => 'EA WAD',
'genre' => 8,
'documentaire' => 0,
'section' => 3,
'activite' => 'En rayon',
'emplacement' => 0,
'annexe' => 1,
'date_nouveaute' => '0000-00-00',
'id_origine' => '00013313',
'id_int_bib' => 1,
'is_available' => 1]);
$this->fixture('Class_Pret', ['id' => 98216,
'id_site' => 1,
'pergame' => 291392,
'id_notice_origine' => '13313',
'en_cours' => 1,
'date_pret' => '2015-02-17',
'date_retour' => '2015-03-31',
'code_barres' => '0213689147']);
}
}
class NoticeAjaxControllerPergameItemNoDefaultLabelTest
extends NoticeAjaxControllerPergameItemTestCase {
public function setUp() {
parent::setUp();
$cfg = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray();
$cfg['exemplaires']['grouper'] = 1;
unset($cfg['exemplaires']['en_pret']);
Class_Profil::getCurrentProfil()->setCfgNotice($cfg);
$this->dispatch('/noticeajax/exemplaires/id_notice/23', true);
}
/** @test */
public function availabilityLabelShouldBeEmprunte() {
$this->assertXPathContentContains('//td[contains(@class, "dispo")]',
'emprunt',
$this->_response->getBody());
}
}
class NoticeAjaxControllerPergameItemLabelConfiguredTest
extends NoticeAjaxControllerPergameItemTestCase {
public function setUp() {
parent::setUp();
$cfg = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray();
$cfg['exemplaires']['grouper'] = 1;
$cfg['exemplaires']['en_pret'] = 'En pret';
Class_Profil::getCurrentProfil()->setCfgNotice($cfg);
$this->dispatch('/noticeajax/exemplaires/id_notice/23', true);
}
/** @test */
public function availabilityLabelShouldBeEnPret() {
$this->assertXPathContentContains('//td[contains(@class, "dispo")]',
'En pret',
$this->_response->getBody());
}