diff --git a/library/ZendAfi/View/Helper/Accueil/Prets.php b/library/ZendAfi/View/Helper/Accueil/Prets.php index 6cf95e10f6881624a92bf994263448da78d13576..79eadaa819d7ce869c8b46ff403360026b8a2f0e 100644 --- a/library/ZendAfi/View/Helper/Accueil/Prets.php +++ b/library/ZendAfi/View/Helper/Accueil/Prets.php @@ -25,7 +25,7 @@ class ZendAfi_View_Helper_Accueil_Prets extends ZendAfi_View_Helper_Accueil_Abon protected $_boite_id = 'prets'; public function getModels() { - return $this->_abonne->getEmprunts(); + return (new Class_User_Cards($this->_abonne))->getLoans(); } diff --git a/library/ZendAfi/View/Helper/Accueil/Reservations.php b/library/ZendAfi/View/Helper/Accueil/Reservations.php index 2fbeb823482556be1abc0821c12dd8e65b3ff1c1..d305a0dec486e64af12832aaaf103a581b93b8d1 100644 --- a/library/ZendAfi/View/Helper/Accueil/Reservations.php +++ b/library/ZendAfi/View/Helper/Accueil/Reservations.php @@ -22,11 +22,6 @@ class ZendAfi_View_Helper_Accueil_Reservations extends ZendAfi_View_Helper_Accue protected $_titre_action = 'reservations'; protected $_boite_id = 'reservations'; - public function getModels() { - return $this->_abonne->getReservations(); - } - - public function renderElement($title, $status, $notice) { return $this->view->tag('li', '[' . $status . '] ' . $this->view->tagAnchor($this->view->urlNotice($notice), $title)); @@ -60,7 +55,7 @@ class ZendAfi_View_Helper_Accueil_Reservations extends ZendAfi_View_Helper_Accue public function getContenu() { return - $this->renderModelReservations($this->_abonne->getReservations()) . + $this->renderModelReservations((new Class_User_Cards($this->_abonne))->getHolds()) . $this->renderModelConsultations($this->_abonne->getConsultations()); } } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php b/tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php index a90618308b75496574bf203ffa172c0c960fe3cb..b5d2854bb9282308ef3b0878100f678171ee1646 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php @@ -16,12 +16,12 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; -class ReservationsTestWithConnectedUser extends ViewHelperTestCase { +class ReservationsTestWithConnectedUser extends ViewHelperTestCase { public function setUp() { parent::setUp(); @@ -29,7 +29,7 @@ class ReservationsTestWithConnectedUser extends ViewHelperTestCase { 'type_module'=>'RESERVATIONS', 'division' => '1', 'preferences' => ['titre' => 'Mes reservations']]); - + $helper->setView(new ZendAfi_Controller_Action_Helper_View()); $propaganda = new Class_WebService_SIGB_Reservation('13', new Class_WebService_SIGB_Exemplaire(456)); $propaganda->getExemplaire() @@ -53,14 +53,14 @@ class ReservationsTestWithConnectedUser extends ViewHelperTestCase { $emprunteur->reservationsAddAll(array( $propaganda,$en_suivant_emma)); $this->html = $helper->getBoite(); } - + /** @test */ public function h1ShouldContainsMesReservations () { $this->assertXPathContentContains($this->html,'//h1','Mes reservations'); } - + /** @test */ public function listShouldDisplayPropagandaNotice() { $this->assertXPathContentContains($this->html,'//ul//li','Propaganda'); @@ -89,12 +89,12 @@ class ReservationsTestWithConnectedUser extends ViewHelperTestCase { public function titleShouldBeLinkedToAbonneReservations () { $this->assertXPath($this->html,'//h1//a[contains(@href,"/abonne/reservations")]',$this->html); } - - } -class ReservationsTestWithNonConnectedUser extends ViewHelperTestCase { + + +class ReservationsTestWithNonConnectedUser extends ViewHelperTestCase { public function setUp() { parent::setUp(); @@ -106,7 +106,7 @@ class ReservationsTestWithNonConnectedUser extends ViewHelperTestCase { $this->helper->setView(new ZendAfi_Controller_Action_Helper_View()); $this->html = $this->helper->getBoite(); } - + /** @test */ public function boiteReservationsShouldNotBeDisplayed () { diff --git a/tests/scenarios/MultiCards/MultiCardsTest.php b/tests/scenarios/MultiCards/MultiCardsTest.php index dbc3e395f5d3cf65839b5419e33cd2684b1dcf40..333e115dddcaa5358e18aa117c731cde791ad398 100644 --- a/tests/scenarios/MultiCards/MultiCardsTest.php +++ b/tests/scenarios/MultiCards/MultiCardsTest.php @@ -466,9 +466,16 @@ class Scenario_AbonneMultiCardsAccountOfEwokFicheActionTest public function setUp() { parent::setUp(); - $cfg_accueil = ['modules' => ['1' => ['division' => '4', - 'type_module' => 'LOGIN', - 'preferences' => []]]]; + $cfg_accueil = ['modules' => [ + ['division' => 4, + 'type_module' => 'LOGIN', + 'preferences' => []], + ['division' => 1, + 'type_module' => 'RESERVATIONS', + 'preferences' => []], + ['division' => 1, + 'type_module' => 'PRETS', + 'preferences' => []]]]; Class_Profil::getCurrentProfil() ->setCfgAccueil($cfg_accueil) ->assertSave(); @@ -484,6 +491,21 @@ class Scenario_AbonneMultiCardsAccountOfEwokFicheActionTest } + /** @test */ + public function loansWidgetShouldContainsUlLiWithPotter() { + $this->assertXPathContentContains('//div[@class="boite prets"]//ul//li', + 'Potter'); + } + + + /** @test */ + public function holdsWidgetShouldContainsUlLiWithArcadia() { + $this->assertXPathContentContains('//div[@class="boite reservations"]//ul//li', + 'Arcadia', + $this->_response->getBody()); + } + + /** @test */ public function loginWidgetShouldContainsYouHaveOneHold() { $this->assertXPathContentContains('//div[@id="boite_login"]//a[@class="account-booking"]',