Skip to content
Snippets Groups Projects
Commit ddd9530d authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT
Browse files

hotline#121248 : Associated Identities should be displayed only when Identity Providers are enabled

parent 259bb686
Branches
Tags
1 merge request!3719hotline#121248 : Associated Identities should be displayed only when Identity Providers are enabled
Pipeline #11560 passed with stage
in 52 minutes and 26 seconds
- ticket #121248 : Fiche Abonné : Le bouton mes comptes associés dans le compte lecteur ne s\'affiche que si IdentityProviders est Activé.
\ No newline at end of file
......@@ -22,9 +22,12 @@
class ZendAfi_View_Helper_Abonne_AssociatedProviders extends ZendAfi_View_Helper_Abonne_Abstract {
public function abonne_associatedProviders($user) {
return $this->tagFicheAbonne($this->_('Mes comptes associés'),
'cards',
$this->view->url(['controller' => 'abonne',
'action' => 'associated-providers']));
return (Class_AdminVar::isIdentityProvidersEnabled()
&& (Class_IdentityProvider::countBy(['active'=>true]) > 0))
? $this->tagFicheAbonne($this->_('Mes comptes associés'),
'cards',
$this->view->url(['controller' => 'abonne',
'action' => 'associated-providers']))
:'';
}
}
......@@ -191,6 +191,29 @@ class AbonneControllerFicheAsAdminDisableSuggestAndBookmarkableLibrariesTest ext
class AbonneControllerFicheWithIdentityProvidersEnabledTest extends AbstractAbonneControllerFicheTest {
public function setUp() {
parent::setUp();
Class_AdminVar::set('ENABLE_IDENTITY_PROVIDERS', 1);
Class_IdentityProvider::newInstance(['label' => 'cassifié',
'type' => 'cas2',
'config' => '{"client_id":"ABCD";"client_secret":"EFGH"}',
'active' => true])->assertSave();
$this->dispatch('/abonne/fiche', true);
}
/** @test */
public function linkToAssociatedProvidersShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/abonne/associated-providers")]');
}
}
class AbonneControllerFicheActionWithLoggedUserTest extends AbstractAbonneControllerFicheTest {
public function setUp() {
parent::setUp();
......@@ -210,9 +233,11 @@ class AbonneControllerFicheActionWithLoggedUserTest extends AbstractAbonneContro
}
/** @test */
public function mesComptesAssociesLinkShouldBePresent() {
$this->assertXPath('//div//a[contains(@href, "/abonne/associated-providers")]');
/** @test
* cf https://forge.afi-sa.net/issues/121248
*/
public function withIdentityProvidersDisabledmesComptesAssociesLinkShouldNotBePresent() {
$this->assertNotXPath('//div//a[contains(@href, "/abonne/associated-providers")]');
}
}
......
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