diff --git a/VERSIONS_HOTLINE/36324 b/VERSIONS_HOTLINE/36324 new file mode 100644 index 0000000000000000000000000000000000000000..ecf370ca436b22cecc1d65fc10ed41c26dafa6e0 --- /dev/null +++ b/VERSIONS_HOTLINE/36324 @@ -0,0 +1 @@ + - ticket #36324 : Affichage des ressources PNB / ToutApprendre / Arte VOD/ 1DTOUCH sur profil smartphone \ No newline at end of file diff --git a/application/modules/telephone/controllers/AuthController.php b/application/modules/telephone/controllers/AuthController.php index 3f6bed50985b9111a2959fdb40c0d2368b70a8de..763316755d0a6cca3875498c46f2e48d5bfb6ffe 100644 --- a/application/modules/telephone/controllers/AuthController.php +++ b/application/modules/telephone/controllers/AuthController.php @@ -79,7 +79,7 @@ class Telephone_AuthController extends AuthController { $this->_redirect($this->view->url(), array('prependBase' => false)); } - $this->view->error = $this->_flashMessenger->getMessages(); + $this->view->error = $this->_flashMessenger->getNotifications(); $this->view->form = $form; } diff --git a/application/modules/telephone/controllers/RechercheController.php b/application/modules/telephone/controllers/RechercheController.php index 778280c6d8116b62c2896bd40673ecc5a0023688..1a17a97d368e0d350cc11931c6e056e1afe6c1a0 100644 --- a/application/modules/telephone/controllers/RechercheController.php +++ b/application/modules/telephone/controllers/RechercheController.php @@ -68,8 +68,12 @@ class Telephone_RechercheController extends RechercheController { if($notice->isToutApprendre()) { $actions[$this->_('Cours ToutApprendre')] = $action_array; + return $actions; } + + $actions[$this->_('Accéder à la ressource')] = $action_array; + return $actions; } diff --git a/application/modules/telephone/views/scripts/auth/login-reservation.phtml b/application/modules/telephone/views/scripts/auth/login-reservation.phtml index db6c45feb3bf49920b4f7010a8d40517db3e876b..11d718b4444e21b3b0c1793afc831bfb3e690426 100644 --- a/application/modules/telephone/views/scripts/auth/login-reservation.phtml +++ b/application/modules/telephone/views/scripts/auth/login-reservation.phtml @@ -1,5 +1,11 @@ <?php echo $this->toolbar($this->_("Identification"));?> <div data-role="content"> - <?php echo $this->form;?> - <?php if (0 < count($this->error)) echo '<strong style="color:red">' . $this->error[0] . '</strong>';?> -</div> \ No newline at end of file + <?php + + echo $this->form; + + foreach($this->error as $error) { + echo '<strong style="color:red">' . $error->getMessage() . '</strong>'; + } + ?> +</div> diff --git a/application/modules/telephone/views/scripts/recherche/viewnotice.phtml b/application/modules/telephone/views/scripts/recherche/viewnotice.phtml index b7fa717c53feabfc28e6e0a729fd5befa13fadd0..3b2511dde4b00c18e9d31b3937f9c270e7e3e43f 100644 --- a/application/modules/telephone/views/scripts/recherche/viewnotice.phtml +++ b/application/modules/telephone/views/scripts/recherche/viewnotice.phtml @@ -2,7 +2,7 @@ echo $this->toolbar($this->_("Recherche"), array('action' => 'simple')); ?> -<ul data-role="listview" data-inset="true"> +<ul data-role="listview" data-inset="true" class="doctype_<?php echo $this->notice->getTypeDoc();?>"> <li data-theme="c"> <img src="<?php echo $this->notice->fetchUrlVignette();?>"> <h3><?php echo $this->iconeSupport($this->notice->getTypeDoc()) . $this->notice->getTitrePrincipal() ;?></h3> @@ -22,9 +22,11 @@ echo $this->toolbar($this->_("Recherche"), ?></p> </li> <?php foreach ($this->actions as $libelle => $action) { - echo $this->tag('li',$this->tagAnchor(['action' => $action['action']], - $libelle, - isset($action['attribs']) ? $action['attribs'] : []) , ['class' => 'lien']); + echo $this->tag('li', + $this->tagAnchor(['action' => $action['action']], + $libelle, + isset($action['attribs']) ? $action['attribs'] : []), + ['class' => 'lien ' . $action['action']]); } ?> </ul> diff --git a/library/Class/Album/Renderer.php b/library/Class/Album/Renderer.php index c0b9229dbf728ce7e97ab176c76a05e3d1b9a3f2..c1487b9230089bb87461df07e94b2e5dc95bb25d 100644 --- a/library/Class/Album/Renderer.php +++ b/library/Class/Album/Renderer.php @@ -49,8 +49,9 @@ class Class_Album_Renderer { 'tagAlbumMediaList' => function($album) { return true; }]; foreach($mapping as $helper => $closure) - if ($closure($this->_album)) + if ($closure($this->_album)) { return call_user_func_array([$view, $helper], [$this->_album]); + } } } ?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagDilicomWidget.php b/library/ZendAfi/View/Helper/TagDilicomWidget.php index bca19dee6af65aca8ec03b2b917be44ff24b655a..06a32ae6a03cdab36403922d4a515d4837a1f0d0 100644 --- a/library/ZendAfi/View/Helper/TagDilicomWidget.php +++ b/library/ZendAfi/View/Helper/TagDilicomWidget.php @@ -28,12 +28,6 @@ class ZendAfi_View_Helper_TagDilicomWidget extends Zend_View_Helper_HtmlElement $this->_album = $album; (new Class_WebService_BibNumerique_Dilicom_Hub())->updateStatus($album); - $iframe = $this->view->tag('iframe', - null, - ['src' => $this->_album->getExternalURI(), - 'width' => '100%', - 'height' => '600px']); - $links = $this->view->tag('p', $this->view->_('Vous n\'avez pas le droit d\'accéder à la consultation en ligne.')); $this->_user = Class_Users::getIdentity(); @@ -41,22 +35,42 @@ class ZendAfi_View_Helper_TagDilicomWidget extends Zend_View_Helper_HtmlElement $links = $this->getConsultBookAnchor() . $this->getLoanBookAnchor(); - return $links . $iframe; + return $links . $this->renderBookPreview($album); + } + + + public function renderBookPreview($album) { + return $this->view->tag('iframe', + null, + ['src' => $this->_album->getExternalURI(), + 'width' => '100%', + 'height' => '600px']); } + protected function getConsultBookAnchor() { return $this->getDilicomAnchor(['controller' => 'bib-numerique', - 'action' => 'consult-book-ajax', + 'action' => $this->_getConsultBookAction(), 'id' => $this->_album->getId()], $this->view->_('Consulter le livre en ligne (depuis la médiathèque)'), ['data-popup' => 'true']); } + protected function _getConsultBookAction() { + return 'consult-book-ajax'; + } + + + protected function _getLoanBookAction() { + return 'loan-book-ajax'; + } + + protected function getLoanBookAnchor() { return $this->getDilicomAnchor(['controller' => 'bib-numerique', - 'action' => 'loan-book-ajax', + 'action' => $this->_getLoanBookAction(), 'id' => $this->_album->getId()], $this->view->_('Emprunter le livre au format EPUB'), ['data-popup' => 'true']); diff --git a/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php b/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php index 1d13a75a3d65ba871edb6bbedba462780ba99a90..c914d248b8a08b1c873b19a38ebe98b89799c36e 100644 --- a/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php +++ b/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php @@ -25,39 +25,6 @@ class ZendAfi_View_Helper_Telephone_RenderAlbum extends ZendAfi_View_Helper_Rend ? sprintf('<div id="resnum">%s</div>', $this->renderAlbumHelper($album)) : $this->view->_('Aucune ressource numérique trouvée.'); } - - - public function renderAlbumHelper($album) { - if ($album->isLivreNumerique()) { - Class_ScriptLoader::getInstance()->loadBooklet($album->getId(), '#resnum'); - return ''; - } - - if ($album->isDiaporama() && $album->hasOnlyImages()) - return $this->view->tagSlideshow($album); - - if ($album->isGallica()) - return $this->view->gallicaPlayer($album); - - if ($album->isArteVod()) - return $this->view->tagVideo($album); - - if ($album->isEPUB()) - return $this->view->monocleReader($album); - - if ($album->isAudioRecord()) - return $this->view->tagAlbumTrackList($album); - - if($album->isCoursToutApprendre()) { - Class_ScriptLoader::getInstance() - ->addAdminScript('onload_utils') - ->addJQueryReady('setupAnchorsTarget();'); - - return parent::renderAlbumHelper($album); - } - - return $this->view->tagAlbumMediaList($album); - } } ?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Telephone/TagAlbumMediaList.php b/library/ZendAfi/View/Helper/Telephone/TagAlbumMediaList.php index 0fac2742e953f370ec167a577fcf54211cfe6ef3..46508d1ca19ddc0d7974461a7ec91cbf2e7a6ff0 100644 --- a/library/ZendAfi/View/Helper/Telephone/TagAlbumMediaList.php +++ b/library/ZendAfi/View/Helper/Telephone/TagAlbumMediaList.php @@ -16,40 +16,40 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Telephone_TagAlbumMediaList extends ZendAfi_View_Helper_TagAlbumMediaList { - protected $_builder; + protected $_builder; public function tagAlbumMediaList($album) { $ressources = $album->getRessources(); - $xspf_url = $this->view->url(['module' => 'telephone', + $xspf_url = $this->view->url(['module' => 'telephone', 'controller' => 'bib-numerique', - 'action' => 'album-xspf-playlist', + 'action' => 'album-xspf-playlist', 'id' => $album->getId()]); - $podcast_url = $this->view->url(['module' => 'telephone', + $podcast_url = $this->view->url(['module' => 'telephone', 'controller' => 'bib-numerique', - 'action' => 'Album-rss-feed', + 'action' => 'Album-rss-feed', 'id' => $album->getId()]); $html=''; foreach($ressources as $ressource) { - $html .= sprintf('<li data-role="list-divider"><a href=%s data-ajax="false"><img src=%s><h3>%s</h3></a></li>', - $this->view->absoluteUrl($ressource->getOriginalUrl()), - $this->view->absoluteurl($ressource->getThumbnailUrl()), - $ressource->getTitre() ? $ressource->getTitre() : $ressource->getFichier());} + $html .= sprintf('<li data-role="list-divider"><a href=%s data-ajax="false"><img src=%s><h3>%s</h3></a></li>', + $this->view->absoluteUrl($ressource->getOriginalUrl()), + $this->view->absoluteurl($ressource->getThumbnailUrl()), + $ressource->getTitre() ? $ressource->getTitre() : $ressource->getFichier());} $playlist = sprintf('<a href="%s" data-role="button" data-mini="true" data-ajax="false" data-icon="list-alt">%s</a>', - $this->view->absoluteUrl($xspf_url.'.xspf'), + $this->view->absoluteUrl($xspf_url.'.xspf'), $this->view->_('Playlist'), ['data-ajax' => 'false']); $rss = sprintf('<a href="%s" data-role="button" data-mini="true" data-icon="rss" data-ajax="false">%s</a>', - $this->view->absoluteUrl($podcast_url.'.xml'), - $this->view->_('RSS')); - + $this->view->absoluteUrl($podcast_url.'.xml'), + $this->view->_('RSS')); + return '<ul data-role="listview">' . $html . '</ul><fieldset class="ui-grid-a"><div class="ui-block-a">' .$playlist.'</div><div class="ui-block-b">' .$rss . '</div></fieldset>' ; } diff --git a/library/ZendAfi/View/Helper/Telephone/TagCoursToutApprendre.php b/library/ZendAfi/View/Helper/Telephone/TagCoursToutApprendre.php new file mode 100644 index 0000000000000000000000000000000000000000..45c93aaf5bde9acf16bc4de651b2f850fdfd2092 --- /dev/null +++ b/library/ZendAfi/View/Helper/Telephone/TagCoursToutApprendre.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +class ZendAfi_View_Helper_Telephone_TagCoursToutApprendre extends ZendAfi_View_Helper_TagCoursToutApprendre { + public function tagCoursToutApprendre($album) { + Class_ScriptLoader::getInstance() + ->addAdminScript('onload_utils') + ->addJQueryReady('setupAnchorsTarget();'); + return parent::tagCoursToutApprendre($album); + } +} + +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Telephone/TagDilicomWidget.php b/library/ZendAfi/View/Helper/Telephone/TagDilicomWidget.php new file mode 100644 index 0000000000000000000000000000000000000000..75c231a6c8072e3abc40f79d405ffbca0189e8b2 --- /dev/null +++ b/library/ZendAfi/View/Helper/Telephone/TagDilicomWidget.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +class ZendAfi_View_Helper_Telephone_TagDilicomWidget extends ZendAfi_View_Helper_TagDilicomWidget { + protected function _getLoanBookAction() { + return 'loan-book'; + } + + + protected function _getConsultBookAction() { + return 'consult-book'; + } + + + public function renderBookPreview($album) { + // too much performance issues + return ''; + } + +} + +?> \ No newline at end of file diff --git a/tests/application/modules/telephone/controllers/AuthControllerTest.php b/tests/application/modules/telephone/controllers/AuthControllerTest.php index 3955605151bce39ce9c127719cb98e741aa9b676..79742371b3b9614a0e4a232a4f38021462596484 100644 --- a/tests/application/modules/telephone/controllers/AuthControllerTest.php +++ b/tests/application/modules/telephone/controllers/AuthControllerTest.php @@ -109,6 +109,11 @@ class AuthControllerTelephoneLoginReservationTest extends AuthControllerTelephon ->whenCalled('hasIdentity') ->answers(false); + + $messenger = new ZendAfi_Controller_Action_Helper_FlashMessenger(); + $messenger->addNotification('An error occured'); + ZendAfi_Controller_Action_Helper_FlashMessenger::reset(); + $this->dispatch('auth/login-reservation/id/45324', true); } @@ -136,6 +141,11 @@ class AuthControllerTelephoneLoginReservationTest extends AuthControllerTelephon $this->assertXPath('//form//input[@placeholder="password"]', $this->_response->getBody()); } + + /** @test */ + public function pageShouldContainsAnErrorOccured() { + $this->assertXPathContentContains('//div', 'An error occured', $this->_response->getBody()); + } } @@ -162,6 +172,7 @@ class AuthControllerTelephoneLoginReservationInvalidPostTest extends AuthControl public function flashMessengerShouldContainsErrorMessage() { $this->assertFlashMessengerContains('Entrez votre identifiant S.V.P.'); } + } diff --git a/tests/application/modules/telephone/controllers/BibNumeriqueControllerTest.php b/tests/application/modules/telephone/controllers/BibNumeriqueControllerTest.php index d0367869ad7ba98307133ce50f471c92c4eb564a..bb3b1c787d9392d5426332b79bab9666ef6c9afb 100644 --- a/tests/application/modules/telephone/controllers/BibNumeriqueControllerTest.php +++ b/tests/application/modules/telephone/controllers/BibNumeriqueControllerTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'TelephoneAbstractControllerTestCase.php'; @@ -101,7 +101,7 @@ class BibNumeriqueControllerTelephoneViewAlbumMultiMedia extends TelephoneAbstra parent::setUp(); Class_Album::newInstanceWithId(999) - ->beDiaporama() + ->setTypeDocId(Class_TypeDoc::AUDIO_RECORD) ->setTitre('Antigone') ->setDateMaj('2012-02-17 10:00:00') ->setAuteur('Sophocle') @@ -128,13 +128,13 @@ class BibNumeriqueControllerTelephoneViewAlbumMultiMedia extends TelephoneAbstra /** @test */ public function pageShouldContainsLinkToRSSPodcast() { - $this->assertXPath('//a[contains(@href, "bib-numerique/Album-rss-feed/id/999.xml")][@data-ajax="false"]'); + $this->assertXPath('//a[contains(@href, "bib-numerique/album-rss-feed/id/999.xml")][@data-ajax="false"]'); } - + /** @test */ - public function pageShouldContainLinkIntroductionMp3() { - $this->assertXPath('//a[contains(@href, "media/introduction.mp3")]'); + public function pageShouldContainLinkToIntroductionMp3PlayResource12() { + $this->assertXPath('//a[contains(@data-src, "bib-numerique/play-ressource/id/12.mp3")]'); } } diff --git a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php index 5f2b35c636157749a935ab5dec71014e768c3060..71030afafbfe9b33d4c37ba3daa110f329e4708b 100644 --- a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php +++ b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php @@ -31,6 +31,7 @@ abstract class Telephone_RechercheControllerHarryPotterTestCase extends Telephon $potter = Class_Notice::getLoader() ->newInstanceWithId(4) + ->beLivre() ->setClefAlpha('harrypotter-sorciers') ->setClefOeuvre('HARRYPOT') ->setClefChapeau('HARRY POTTER') @@ -106,13 +107,13 @@ class Telephone_RechercheControllerHarryPotterViewNoticeTest extends Telephone_R /** @test */ public function pageShouldContainsLinkToCritiques() { - $this->assertXPathContentContains('//a[contains(@href, "recherche/avis/id/4")]', 'Critiques'); + $this->assertXPathContentContains('//li[contains(@class, "avis")]/a[contains(@href, "recherche/avis/id/4")]', 'Critiques'); } /** @test */ public function pageShouldContainsLinkToExemplaires() { - $this->assertXPathContentContains('//a[contains(@href, "recherche/exemplaires/id/4")]', 'Où le trouver'); + $this->assertXPathContentContains('//ul[contains(@class, "doctype_1")]/li[contains(@class, "exemplaires")]//a[contains(@href, "recherche/exemplaires/id/4")]', 'Où le trouver'); } diff --git a/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php b/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php index 4acb8b472f81f064297280597df9e8886ea924f4..017aaf64bd4806d2e4170bb7928ce587116b0176 100644 --- a/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php +++ b/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php @@ -22,7 +22,7 @@ require_once 'TelephoneAbstractControllerTestCase.php'; abstract class Telephone_RechercheControllerRessourceNumeriqueTestCase extends TelephoneAbstractControllerTestCase { - protected $_summary; + protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); @@ -49,24 +49,33 @@ abstract class Telephone_RechercheControllerRessourceNumeriqueTestCase extends T -class Telephone_RechercheControllerPropagandaViewNoticeTest extends Telephone_RechercheControllerRessourceNumeriqueTestCase { +class Telephone_RechercheControllerPropagandaRessourceNumeriqueViewNoticeTest extends Telephone_RechercheControllerRessourceNumeriqueTestCase { public function setUp() { parent::setUp(); - $this->dispatch('/telephone/recherche/viewnotice/id/9', true); + + $this->fixture('Class_Album', + ['id' => 4, + 'titre' => 'Propaganda', + 'visible' => true, + 'status' => Class_Album::STATUS_VALIDATED, + 'type_doc_id' => Class_TypeDoc::EPUB])->index(); + + $this->dispatch('/telephone/recherche/viewnotice/id/1', true); } /** @test */ public function pageShouldContainsLinkToRessouresNumeriquesEpub() { - $this->assertNotXPathContentContains('//a[contains(@href, "ressourcesnumeriques/id/9")][@data-ajax="false"]', + $this->assertXPathContentContains('//a[contains(@href, "ressourcesnumeriques/id/1")][@data-ajax="false"]', 'Feuilleter le livre',$this->_response->getBody()); } - } -class Telephone_RechercheControllerNumericRessourcesTest extends TelephoneAbstractControllerTestCase { + + +class Telephone_RechercheControllerRessourceNumeriqueToutApprendreTest extends TelephoneAbstractControllerTestCase { protected $_storm_default_to_volatile = true; public function setUp() { @@ -102,4 +111,87 @@ class Telephone_RechercheControllerNumericRessourcesTest extends TelephoneAbstra public function wrongAccountRequirementMessageShouldBeDisplay() { $this->assertXPathContentContains('//div//p', 'Vous devez être connecté sous un compte avec abonnement valide pour pouvoir accéder au cours en ligne'); } +} + + + + +class Telephone_RechercheControllerRessourceNumeriqueViewNoticeOneDTouchTest extends Telephone_RechercheControllerRessourceNumeriqueTestCase { + public function setUp() { + parent::setUp(); + $this->fixture('Class_Album', + ['id' => 1, + 'titre' => 'Hypnophonic', + 'visible' => true, + 'status' => Class_Album::STATUS_VALIDATED, + 'type_doc_id' => Class_TypeDoc::ONEDTOUCH])->index(); + } + + + /** @test */ + public function pageShouldContainsLinkToRessouresNumeriques() { + $this->dispatch('/telephone/recherche/viewnotice/id/1', true); + + $this->assertXPathContentContains('//ul[contains(@class, "doctype_114")]//a[contains(@href, "ressourcesnumeriques/id/1")][@data-ajax="false"]', + 'Accéder à la ressource',$this->_response->getBody()); + } +} + + + + +class Telephone_RechercheControllerRessourceNumeriqueViewNoticePNBTest extends Telephone_RechercheControllerRessourceNumeriqueTestCase { + public function setUp() { + parent::setUp(); + $this->fixture('Class_Album', + ['id' => 1, + 'titre' => 'Hypnophonic', + 'visible' => true, + 'status' => Class_Album::STATUS_VALIDATED, + 'type_doc_id' => Class_TypeDoc::DILICOM])->index(); + + $logged_user = $this->fixture('Class_Users', + ['id' => 6, + 'nom'=>'Pito', + 'login'=>'Chat', + 'password'=>'123456', + 'id_site' => 1, + 'idabon' => '12345', + 'user_groups' => [$this->fixture('Class_UserGroup', + ['id' => '20', + 'libelle' => 'Multimedia', + 'rights' => [Class_UserGroup::RIGHT_ACCES_PNB_DILICOM]])]]); + $logged_user->beAbonneSIGB()->assertSave(); + ZendAfi_Auth::getInstance()->logUser($logged_user); + } + + + /** @test */ + public function pageShouldContainsLinkToRessouresNumeriques() { + $this->dispatch('/telephone/recherche/viewnotice/id/1', true); + + $this->assertXPathContentContains('//ul[contains(@class, "doctype_112")]//a[contains(@href, "ressourcesnumeriques/id/1")][@data-ajax="false"]', + 'Accéder à la ressource',$this->_response->getBody()); + } + + + /** @test */ + public function loanBookActionShouldBeLoanBookNotAjax() { + $this->dispatch('/telephone/recherche/ressourcesnumeriques/id/1', true); + $this->assertXPath('//a[contains(@href, "bib-numerique/loan-book/id/1")]'); + } + + + /** @test */ + public function consultBookActionShouldNotBeVisiable() { + $this->dispatch('/telephone/recherche/ressourcesnumeriques/id/1', true); + $this->assertXPath('//a[contains(@href, "bib-numerique/consult-book/id/1")]'); + } + + + /** @test */ + public function previewIframeShouldNotBeDisplayed() { + $this->dispatch('/telephone/recherche/ressourcesnumeriques/id/1', true); + $this->assertNotXPath('//iframe'); + } } \ No newline at end of file