Skip to content
Snippets Groups Projects
Commit 515ae4aa authored by llaffont's avatar llaffont
Browse files

Fiche abonne: affiche les liens prets et reservations seulement si...

Fiche abonne: affiche les liens prets et reservations seulement si l'utilisateur connecté est un abonné
parent 9647f9be
Branches
Tags
No related merge requests found
......@@ -20,6 +20,9 @@
*/
class ZendAfi_View_Helper_Abonne_Prets extends ZendAfi_View_Helper_Abonne_Abstract {
public function abonne_prets($user) {
if (!$user->isAbonne())
return '';
$fiche_sigb = $user->getFicheSigb();
if (!isset($fiche_sigb['fiche']))
return '';
......
......@@ -20,6 +20,9 @@
*/
class ZendAfi_View_Helper_Abonne_Reservations extends ZendAfi_View_Helper_Abonne_Abstract {
public function abonne_reservations($user) {
if (!$user->isAbonne())
return '';
$fiche_sigb = $user->getFicheSigb();
if (!isset($fiche_sigb['fiche']))
return '';
......
......@@ -19,22 +19,66 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class AbstractAbonneControllerFicheTest extends AbstractControllerTestCase {
abstract class AbstractAbonneControllerFicheTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->marcus = Class_Users::newInstanceWithId(10,
['prenom' => 'Marcus',
'nom' => 'Miller'])->beAdminPortail();
'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->dispatch('/abonne/fiche', true);
$this->assertXPathContentContains('//a[contains(@href, "/abonne/suggestion-achat")]',
'Suggérer un achat');
}
/** @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")]');
}
}
......
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