diff --git a/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php b/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php index 20d07ce947cabac56257d28c27857e7d00f7881d..cb632a8b0ec18452493faa382e2bc032ae756ef0 100644 --- a/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php +++ b/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php @@ -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'));