Skip to content
Snippets Groups Projects
Commit 062c9bf2 authored by Patrick Barroca's avatar Patrick Barroca
Browse files

rel #46123 : fix test failures

parent b3fc75b4
Branches
Tags
5 merge requests!1803Master,!1797Master,!1793Master,!1792Stable,!1788Hotline#46123 pb acces a la bib numerique par les administrateurs bibliotheques
......@@ -90,6 +90,12 @@ class ZendAfi_Acl_AdminControllerGroup {
}
/** @category testing */
public static function setAcl($acl) {
static::$_acl = $acl;
}
protected function getAcl() {
return static::$_acl
? static::$_acl
......
......@@ -109,13 +109,13 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl {
$this->allow('modo_bib','index');
$this->allow('modo_bib','stat');
$this->allow('modo_bib','accueil');
$this->allow('modo_bib','bib');
$this->allow('modo_bib','upload');
$this->allow('modo_bib','modules');
$this->allow('modo_bib','catalogue');
$this->allow('modo_bib','redmine');
$this->allow('admin_bib','users');
$this->allow('admin_bib','bib');
$this->allow('admin_bib','ouvertures');
$this->allow('admin_bib','profil');
$this->allow('admin_bib','modo');
......
......@@ -18,38 +18,51 @@
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php';
require_once 'fixtures/RessourcesNumeriquesFixtures.php';
abstract class ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableBibnumDisabledTestCase extends ViewHelperTestCase {
abstract class ZendAfi_View_Helper_Admin_MenuGaucheAdminTestCase extends ViewHelperTestCase {
protected $_storm_default_to_volatile = true;
protected $html;
public function setUp() {
parent::setUp();
Class_AdminVar::newInstanceWithId('BIBNUM', ['valeur' => 0]);
$this->_prepareFixtures();
$this->helper = new ZendAfi_View_Helper_Admin_MenuGaucheAdmin();
$this->helper->setView($this->view);
$this->html = $this->helper->menuGaucheAdmin();
}
public function tearDown() {
ZendAfi_View_Helper_Admin_MenuGaucheAdminItem::setAcl(null);
parent::tearDown();
}
protected function _prepareFixtures() {
Class_AdminVar::newInstanceWithId('BIBNUM', ['valeur' => 0]);
Zend_Registry::get('translate')->setLocale('fr');
}
}
class ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableAsAdminTest extends ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableBibnumDisabledTestCase {
protected $html;
class ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableAsAdminTest
extends ZendAfi_View_Helper_Admin_MenuGaucheAdminTestCase {
public function setUp() {
parent::setUp();
public function _prepareFixtures() {
parent::_prepareFixtures();
Zend_Registry::get('translate')->setLocale('fr');
$this->login(ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL);
RessourcesNumeriquesFixtures::activateOrphea();
RessourcesNumeriquesFixtures::deactivateDilicom();
RessourcesNumeriquesFixtures::activateJamendo();
$this->html = $this->helper->menuGaucheAdmin();
}
......@@ -85,16 +98,7 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableAsAdminTest extends ZendA
/** @test */
public function menuImportDilicomShouldNotBeVisibleWhenOptionDILICOM_PNB_isDisabled() {
$this->assertNotXPath($this->helper->menuGaucheAdmin(),
'//a[contains(@href, "/admin/album/dilicom")]');
}
/** @test */
public function menuImportDilicomShouldBeVisibleWhenOptionDILICOM_PNB_isEnabled() {
RessourcesNumeriquesFixtures::activateDilicom();
$this->assertXPath($this->helper->menuGaucheAdmin(),
'//a[contains(@href, "/admin/album/dilicom")]');
$this->assertNotXPath($this->helper->menuGaucheAdmin(), '//a[contains(@href, "/admin/album/dilicom")]');
}
......@@ -136,17 +140,38 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableAsAdminTest extends ZendA
class ZendAfi_View_Helper_Admin_MenuGaucheAdminPNBActivatedAsAdminTest
extends ZendAfi_View_Helper_Admin_MenuGaucheAdminTestCase {
class ZendAfi_View_Helper_Admin_MenuGaucheAdminAsRedacBibTest extends ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableBibnumDisabledTestCase {
public function setUp() {
parent::setUp();
public function _prepareFixtures() {
parent::_prepareFixtures();
$this->login(ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL);
Class_AdminVar::newInstanceWithId('BIBNUM', ['valeur' => 1]);
RessourcesNumeriquesFixtures::activateDilicom();
}
/** @test */
public function menuImportDilicomShouldBeVisibleWhenOptionDILICOM_PNB_isEnabled() {
$this->assertXPath($this->helper->menuGaucheAdmin(), '//a[contains(@href, "/admin/album/dilicom")]');
}
}
class ZendAfi_View_Helper_Admin_MenuGaucheAdminAsRedacBibTest
extends ZendAfi_View_Helper_Admin_MenuGaucheAdminTestCase {
public function _prepareFixtures() {
parent::_prepareFixtures();
$this->login(ZendAfi_Acl_AdminControllerRoles::MODO_BIB);
$this->html = $this->helper->menuGaucheAdmin();
}
/** @test **/
public function BibNumEpubShouldNotBePresent() {
public function bibNumEpubShouldNotBePresent() {
$this->assertNotXPath($this->html, '//a[contains(@href, "/admin/opds")]', $this->html);
}
......@@ -173,6 +198,4 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdminAsRedacBibTest extends ZendAfi_Vi
public function menuCacheImagesShouldNotBePresent() {
$this->assertNotXPath($this->html, '//a[contains(@href, "/admin/systeme/cacheimages")]', $this->html);
}
}
?>
}
\ No newline at end of file
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