Newer
Older
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 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).
*
* AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class AbstractAbonneControllerFicheTest extends AbstractControllerTestCase {
$this->marcus = Class_Users::newInstanceWithId(10,
['prenom' => 'Marcus',
'nom' => 'Miller']);
ZendAfi_Auth::getInstance()->logUser($this->marcus);
}
}
class AbonneControllerFicheAsAdminTest extends AbstractAbonneControllerFicheTest {
public function setUp() {
parent::setUp();
$this->marcus->beAdminPortail();
$this->dispatch('/abonne/fiche', true);
}
/** @test */
public function linkShouldToSuggestionAchatShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "/abonne/suggestion-achat")]',
'Suggérer un achat');
}
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/** @test */
public function linkToPretsShouldNotBePresent() {
$this->assertNotXPath('//a[contains(@href, "/abonne/prets")]');
}
/** @test */
public function linkToReservationsShouldNotBePresent() {
$this->assertNotXPath('//a[contains(@href, "/abonne/reservations")]');
}
}
class AbonneControllerFicheAsAbonneTest extends AbstractAbonneControllerFicheTest {
public function setUp() {
parent::setUp();
$this->marcus->beAbonneSIGB();
$this->dispatch('/abonne/fiche', true);
}
/** @test */
public function linkToPretsShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/abonne/prets")]');
}
/** @test */
public function linkToReservationsShouldNotBePresent() {
$this->assertXPath('//a[contains(@href, "/abonne/reservations")]');
}