Skip to content
Snippets Groups Projects
Commit 4ebd2fa7 authored by efalcy's avatar efalcy
Browse files

dev #24867 : PNB add tests

parent 9e682443
Branches
Tags
4 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1120Master,!1114Dev #24867 pnb remove loan button,!1109Dev #24867 pnb remove loan button
......@@ -281,8 +281,6 @@ abstract class ZendAfi_View_Helper_RenderAlbumDilicomPNBTestCase extends ZendAfi
}
class ZendAfi_View_Helper_RenderAlbumDilicomPNBNotLoggedTest extends ZendAfi_View_Helper_RenderAlbumDilicomPNBTestCase {
public function setUp() {
parent::setUp();
......@@ -293,26 +291,50 @@ class ZendAfi_View_Helper_RenderAlbumDilicomPNBNotLoggedTest extends ZendAfi_Vie
/** @test */
public function htmlShouldNotContainsLinkToConsultBook() {
$this->assertNotXPathContentContains($this->_html,
'//a[contains(@href, "/bib-numerique/consult-book/id/3")]',
$this->assertXPathContentContains($this->_html,
'//a[contains(@href, "/bib-numerique/consult-book-ajax/id/3")]',
'Consulter le livre en ligne');
}
}
class ZendAfi_View_Helper_RenderAlbumDilicomPNBLoggedButNotAuthorizeTest extends ZendAfi_View_Helper_RenderAlbumDilicomPNBTestCase {
public function setUp() {
parent::setUp();
$this->logged_user = $this->fixture('Class_Users',
['id' => 6,
'nom'=>'Pito',
'login'=>'Chat',
'password'=>'123456',
'id_site' => 1,
'idabon' => '12345']);
$this->logged_user->setUserGroups([]);
ZendAfi_Auth::getInstance()->logUser($this->logged_user);
$this->_html = $this->_helper->renderAlbum($this->book);
}
/** @test */
public function htmlShouldContainsMessageToIntroduceLogin() {
$this->assertXPathContentContains($this->_html, '//p', utf8_encode('Vous devez vous connecter pour accéder à la consultation en ligne.'));
public function htmlShouldNotContainsLinkToConsultBook() {
$this->assertXPathContentContains($this->_html,
'//p',utf8_encode("Vous n'avez pas le droit d'accéder à la consultation en ligne."));
}
}
class ZendAfi_View_Helper_RenderAlbumDilicomPNBTest extends ZendAfi_View_Helper_RenderAlbumDilicomPNBTestCase {
public function setUp() {
parent::setUp();
$logged_user = $this->fixture('Class_Users',
$this->logged_user = $this->fixture('Class_Users',
['id' => 6,
'nom'=>'Pito',
'login'=>'Chat',
......@@ -323,8 +345,8 @@ class ZendAfi_View_Helper_RenderAlbumDilicomPNBTest extends ZendAfi_View_Helper_
['id' => '20',
'libelle' => 'Multimedia',
'rights' => [Class_UserGroup::RIGHT_ACCES_PNB_DILICOM]])]]);
$logged_user->beAbonneSIGB()->assertSave();
ZendAfi_Auth::getInstance()->logUser($logged_user);
$this->logged_user->beAbonneSIGB()->assertSave();
ZendAfi_Auth::getInstance()->logUser($this->logged_user);
$this->fixture('Class_Loan_Pnb',
['id' => 1,
......@@ -347,7 +369,7 @@ class ZendAfi_View_Helper_RenderAlbumDilicomPNBTest extends ZendAfi_View_Helper_
/** @test */
public function htmlShouldContainsLinkToConsultBook() {
$this->assertXPathContentContains($this->_html,
'//a[contains(@href, "/bib-numerique/consult-book/id/3")]',
'//a[contains(@href, "/bib-numerique/consult-book-ajax/id/3")]',
'Consulter le livre en ligne');
}
......@@ -355,19 +377,11 @@ class ZendAfi_View_Helper_RenderAlbumDilicomPNBTest extends ZendAfi_View_Helper_
/** @test */
public function htmlShouldContainsLinkToLoanBook() {
$this->assertXPathContentContains($this->_html,
'//a[contains(@href, "/bib-numerique/loan-book/id/3")]',
'//a[contains(@href, "/bib-numerique/loan-book-ajax/id/3")]',
'Emprunter le livre au format EPUB');
}
/** @test */
public function htmlShouldContainsLinkToEndLoanBook() {
$this->assertXPathContentContains($this->_html,
'//a[contains(@href, "/bib-numerique/end-loan-book/id/1")]',
utf8_encode('Rendre le livre emprunté'));
}
/** @test */
public function albumShouldHaveBeenUpdateThroughHubGetLoanStatus() {
$this->assertContains('getLoanStatus', $this->_http->getFirstAttributeForLastCallOn('open_url'));
......
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