Skip to content
Snippets Groups Projects
Commit 4b2739c7 authored by llaffont's avatar llaffont
Browse files

Correction tests onglet avis

parent 66d3c66d
Branches
Tags
No related merge requests found
......@@ -41,14 +41,7 @@ class ZendAfi_View_Helper_Notice_AvisTest extends ViewHelperTestCase {
$this->avis = array("bib" => array("nombre" => 0),
"abonne" => array("nombre" => 0));
$this->avis_bib_seulement = new Class_AdminVar();
$this
->_generateLoaderFor('Class_AdminVar', array('find'))
->expects($this->atLeastOnce())
->method('find')
->with('AVIS_BIB_SEULEMENT')
->will($this->returnValue($this->avis_bib_seulement));
$this->avis_bib_seulement = Class_AdminVar::newInstanceWithId('AVIS_BIB_SEULEMENT');
$account = new stdClass();
$account->username = 'AutoTest' . time();
......@@ -60,11 +53,12 @@ class ZendAfi_View_Helper_Notice_AvisTest extends ViewHelperTestCase {
ZendAfi_Auth::getInstance()->getStorage()->write($account);
}
public function testVisibleWithAdminAndAvisReaderAllowed() {
ZendAfi_Auth::getInstance()->getIdentity()->ROLE_LEVEL = 5;
$this->avis_bib_seulement->setValeur('0');
$html = $this->_helper->getAvis($this->millenium, $this->avis, $this->_view);
$html = $this->_helper->Notice_Avis($this->millenium, $this->avis, ['onglet' => 'bloc']);
$this->assertTrue(strpos($html, 'Donnez ou modifiez votre avis') != false, $html);
}
......@@ -73,7 +67,7 @@ class ZendAfi_View_Helper_Notice_AvisTest extends ViewHelperTestCase {
ZendAfi_Auth::getInstance()->getIdentity()->ROLE_LEVEL = 1;
$this->avis_bib_seulement->setValeur('0');
$html = $this->_helper->getAvis($this->millenium, $this->avis, $this->_view);
$html = $this->_helper->Notice_Avis($this->millenium, $this->avis, ['onglet' => 'bloc']);
$this->assertTrue(strpos($html, 'Donnez ou modifiez votre avis') != false);
}
......@@ -82,7 +76,7 @@ class ZendAfi_View_Helper_Notice_AvisTest extends ViewHelperTestCase {
ZendAfi_Auth::getInstance()->getIdentity()->ROLE_LEVEL = 5;
$this->avis_bib_seulement->setValeur('1');
$html = $this->_helper->getAvis($this->millenium, $this->avis, $this->_view);
$html = $this->_helper->Notice_Avis($this->millenium, $this->avis, ['onglet' => 'bloc']);
$this->assertTrue(strpos($html, 'Donnez ou modifiez votre avis') != false);
}
......@@ -91,7 +85,7 @@ class ZendAfi_View_Helper_Notice_AvisTest extends ViewHelperTestCase {
ZendAfi_Auth::getInstance()->getIdentity()->ROLE_LEVEL = 1;
$this->avis_bib_seulement->setValeur('1');
$html = $this->_helper->getAvis($this->millenium, $this->avis, $this->_view);
$html = $this->_helper->Notice_Avis($this->millenium, $this->avis, ['onglet' => 'bloc']);
$this->assertFalse(strpos($html, 'Donnez ou modifiez votre avis'));
}
}
......
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