diff --git a/VERSIONS b/VERSIONS index db147b13f9540a9f9501b960bd1165ad16dc0b24..cebe9689c59233e3132db7962b12591b5acbe348 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,5 @@ +- ticket #15563: Bibliothèque numérique, affichage en diaporama: ajout d'un paramètre pour spécifier la hauteur de boîte par défaut sur l'affichage public + 04/08/2014 - v6.49.0 - ticket #12992: Champs personnalisés diff --git a/library/ZendAfi/View/Helper/TagSlideshow.php b/library/ZendAfi/View/Helper/TagSlideshow.php index 8f6b71196fb23143bded787a4a6edcd2024b8dd7..f7d24ba055d62d3bbe285e070fda850f17663904 100644 --- a/library/ZendAfi/View/Helper/TagSlideshow.php +++ b/library/ZendAfi/View/Helper/TagSlideshow.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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_TagSlideshow extends Zend_View_Helper_HtmlElement { protected $_default_preferences = array( @@ -41,7 +41,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { if (null == $preferences) $this->_preferences = $this->_default_preferences; else - $this->_preferences = array_merge($this->_default_preferences, + $this->_preferences = array_merge($this->_default_preferences, $preferences); return $this; } @@ -57,9 +57,13 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { if (!$album) return ''; + if (!is_array($preferences)) + $preferences = []; + return $this ->setAlbum($album) - ->setPreferences($preferences) + ->setPreferences(array_merge(['op_hauteur_boite' => $album->getOpHauteurBoite()], + $preferences)) ->renderSlideShowScripts() ->renderAlbumMedias(); } @@ -84,7 +88,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { * @return ZendAfi_View_Helper_Accueil_BibNumerique */ public function renderSlideShowScriptsOn($script_loader, $selector, $options=null) { - $cycle_options = array('pause' => 1, + $cycle_options = array('pause' => 1, 'fx' => 'fade', 'animIn' => array('opacity' => 1), 'animOut' => array('opacity' => 0), @@ -106,13 +110,13 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { var container = $(\'%1$s\').parent(); container.addClass(\'slideshow\'); container.prepend(\'<div class="controls"><a href="#"></a><a href="#"></a></div>\'); - container.find(\'.controls a:first-child\').click( - function(event){ - event.preventDefault(); + container.find(\'.controls a:first-child\').click( + function(event){ + event.preventDefault(); $(\'%1$s\').cycle(\'prev\') } ); container.find(\'.controls a + a\').click( function(event){ - event.preventDefault(); + event.preventDefault(); $(\'%1$s\').cycle(\'next\') } ); container.find(\'.controls a\').css(\'top\', (container.parent().height()/3)+\'px\')', $selector, @@ -133,7 +137,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { '<h2></h2>'. '<div class="medias">%s</div>'. '<p></p>'. - '</div>', + '</div>', $this->_album->getId(), $this->_renderAllMedias($medias)); return $html; @@ -145,7 +149,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { */ protected function _renderAllMedias($medias) { $html = ''; - foreach ($medias as $media) + foreach ($medias as $media) $html .= $this->_renderMedia($media); return $html; } @@ -169,18 +173,18 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { null, true); - $content = $this->view->tagImg($url_media, - array('style' => sprintf('width: %spx', + $content = $this->view->tagImg($url_media, + array('style' => sprintf('width: %spx', $this->_preferences['op_largeur_img']), 'title' => htmlspecialchars($media->getTitre()), 'alt' => htmlspecialchars($media->getDescription()))); - - $datas = array('titre' => $media->getTitre(), - 'content' => $content, + + $datas = array('titre' => $media->getTitre(), + 'content' => $content, 'description' => $media->getDescription()); if ($media->hasLinkTo()) { foreach ($datas as $idx => $data) - $datas[$idx] = sprintf('<a href="%s">%s</a>', + $datas[$idx] = sprintf('<a href="%s">%s</a>', $media->getLinkTo(), $data); } else { @@ -194,13 +198,13 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { $content); } - + $content = sprintf('<h2>%s</h2>'. '%s'. '<p>%s</p>', $datas['titre'], - $datas['content'], + $datas['content'], $datas['description']); return sprintf('<div>%s</div>', $content); diff --git a/public/admin/css/global.css b/public/admin/css/global.css index 7ce464dc97b2a0116ee764be5450f8eee3a8d7be..83404bdc81e466696609fe3922eb076ef3791b8c 100644 --- a/public/admin/css/global.css +++ b/public/admin/css/global.css @@ -908,6 +908,12 @@ form#import_ead dl { } +#resnum .slideshow { + background-color: black; + overflow: hidden; +} + + .tree.thumbwall{ padding-left: 25px; } diff --git a/tests/application/modules/admin/controllers/AlbumControllerTest.php b/tests/application/modules/admin/controllers/AlbumControllerTest.php index be50c3133bfc0cb22abe7c27aac27c66584bc276..8f26bb84dd9c9aff67c96a6710f59d7d356319c4 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerTest.php @@ -16,21 +16,22 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 'AdminAbstractControllerTestCase.php'; -abstract class Admin_AlbumControllerTestCase extends Admin_AbstractControllerTestCase { +abstract class Admin_AlbumControllerTestCase extends Admin_AbstractControllerTestCase { protected $_category_wrapper; public function setUp() { parent::setUp(); $time_source = new TimeSourceForTest('2013-12-14 09:00:00'); + Class_Album::beVolatile(); Class_Album::setTimeSource($time_source); - Class_CosmoVar::newInstanceWithId('types_docs', + Class_CosmoVar::newInstanceWithId('types_docs', ['liste' => "1:cd\r\n200:non identifié\r\n201:livres\r\n202:bd"]); - Class_CosmoVar::newInstanceWithId('nature_docs', + Class_CosmoVar::newInstanceWithId('nature_docs', ['liste' => "1:Collection\r\n2:Manuscrits\r\n3:Image"]); $langue_loader = Class_CodifLangue::getLoader(); @@ -55,7 +56,7 @@ abstract class Admin_AlbumControllerTestCase extends Admin_AbstractControllerTes ->setSousCategories([]) ->setAlbums([]); $adulte->save(); - + $patrimoine = $this->fixture('Class_AlbumCategorie', ['id' => 38]) ->setParentId(0) ->setSousCategories([]) @@ -67,7 +68,7 @@ abstract class Admin_AlbumControllerTestCase extends Admin_AbstractControllerTes $this->fixture('Class_Album', ['id' => 43, 'pcdm4' => 'Musique;Dessin', 'notes' => 'a:3:{s:5:"305$a";s:12:"XIIe siècle";s:5:"200$b";s:9:"Parchemin";s:5:"316$a";s:12:"Reliure bois";}']) - + ->setTitre('Mes BD') ->setTags('bd;dessin') ->setDescription('Les préférées') @@ -96,7 +97,7 @@ abstract class Admin_AlbumControllerTestCase extends Admin_AbstractControllerTes ->setRessources([]) ->save(); - $romans = $this->fixture('Class_Album', + $romans = $this->fixture('Class_Album', ['id' => 24, 'titre' => 'Mes Romans', 'langue' => '']); @@ -124,7 +125,7 @@ class Admin_AlbumControllerIndexTest extends Admin_AlbumControllerTestCase { $favoris = Class_AlbumCategorie::find(2); $favoris->setSousCategories([Class_AlbumCategorie::find(6)]) ->save(); - $this->fixture('Class_Album', ['id' => 66, + $this->fixture('Class_Album', ['id' => 66, 'titre' => "L'orphelin", 'cat_id' => 0]); $this->dispatch('/admin/album', true); @@ -272,7 +273,7 @@ class Admin_AlbumControllerIndexTest extends Admin_AlbumControllerTestCase { /** @test */ public function categorieAlbumsNonClassesShouldHaveAlbumOrphelin() { - $this->assertXPathContentContains('//ul[@class="root"]/li[last()]//li', + $this->assertXPathContentContains('//ul[@class="root"]/li[last()]//li', "L'orphelin", $this->_response->getBody()); } @@ -388,7 +389,7 @@ class Admin_AlbumControllerPostAddCategorieToFavorisTest extends Admin_AlbumCont ->setPost($data); $this->dispatch('/admin/album/add_categorie_to/id/2'); - + $this->new_cat = Class_AlbumCategorie::findFirstBy(['order' => 'id desc']); } @@ -608,7 +609,7 @@ class Admin_AlbumControllerAddAlbumToPatrimoineTest extends Admin_AlbumControlle /** @test */ public function fieldForFichierShouldStateLimitedFilesExtensions() { - $this->assertXPathContentContains('//form[@id="album"]//td', + $this->assertXPathContentContains('//form[@id="album"]//td', '(jpg, gif, png)'); } @@ -679,9 +680,9 @@ class Admin_AlbumControllerPostAlbumRenaissanceToPatrimoineTest extends Admin_Al 'name' => '', 'tmp_name' => '', 'error' => 4]; - $_FILES['pdf'] = ['size' => 0, - 'name' => '', - 'tmp_name' => '', + $_FILES['pdf'] = ['size' => 0, + 'name' => '', + 'tmp_name' => '', 'error' => 4]; $this->fixture('Class_CodifDewey', ['id' => '0277', 'id_dewey' => '0277', @@ -700,7 +701,7 @@ class Admin_AlbumControllerPostAlbumRenaissanceToPatrimoineTest extends Admin_Al 'libelle' => 'Trombone']); - $this->postDispatch('/admin/album/add_album_to/id/38', + $this->postDispatch('/admin/album/add_album_to/id/38', ['titre' => 'Renaissance', 'sous_titre' => 'Ze Renaissance', 'description' => 'Oeuvres majeures sous François 1er', @@ -720,7 +721,7 @@ class Admin_AlbumControllerPostAlbumRenaissanceToPatrimoineTest extends Admin_Al $this->new_notice = $this->new_album->getNotice(); } - + /** @test */ public function newAlbumTitreShouldBeRenaissance() { $this->assertEquals('Renaissance', $this->new_album->getTitre()); @@ -737,11 +738,11 @@ class Admin_AlbumControllerPostAlbumRenaissanceToPatrimoineTest extends Admin_Al public function newAlbumDescriptionShouldBeOeuvresMajeures() { $this->assertEquals('Oeuvres majeures sous François 1er', $this->new_album->getDescription()); } - + /** @test */ public function shouldRedirectToEditAlbum() { - $this->assertRedirectTo('/admin/album/edit_album/id/'.$this->new_album->getId(), + $this->assertRedirectTo('/admin/album/edit_album/id/'.$this->new_album->getId(), implode(' :: ', $this->new_album->getErrors())); } @@ -757,7 +758,7 @@ class Admin_AlbumControllerPostAlbumRenaissanceToPatrimoineTest extends Admin_Al $this->assertEquals('2;3', $this->new_album->getNatureDoc()); } - + /** @test */ public function shouldHaveEditorGlo() { $this->assertContains('Glo', $this->new_album->getEditors()); @@ -911,7 +912,7 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC $this->fixture('Class_CodifGenre', ['id' => 65, 'libelle' => 'CD']); $this->fixture('Class_CodifGenre', ['id' => 66, 'libelle' => 'DVD']); $this->fixture('Class_CodifGenre', ['id' => 67, 'libelle' => 'Partitions']); - + $this->fixture('Class_CodifLangue', ['id' => 'fre', 'libelle' => 'Français']); $this->fixture('Class_CodifLangue', ['id' => 'eng', 'libelle' => 'Anglais']); @@ -919,23 +920,23 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC $this->fixture('Class_Bib', ['id' => '74', 'libelle' => 'Annecy', 'visibilite' => 2]); $this->fixture('Class_Bib', ['id' => '77', 'libelle' => 'Lognes', 'visibilite' => 0]); - $this->fixture('Class_CodifAnnexe', ['id' => 4, - 'libelle' => 'Patrimoine', + $this->fixture('Class_CodifAnnexe', ['id' => 4, + 'libelle' => 'Patrimoine', 'invisible' => 1, 'code' => 32]); - $this->fixture('Class_CodifAnnexe', ['id' => 5, - 'libelle' => 'Archives', + $this->fixture('Class_CodifAnnexe', ['id' => 5, + 'libelle' => 'Archives', 'invisible' => 0, 'code' => 33]); - $this->fixture('Class_CodifAnnexe', ['id' => 73, - 'libelle' => 'News', + $this->fixture('Class_CodifAnnexe', ['id' => 73, + 'libelle' => 'News', 'invisible' => 0, 'code' => 73]); - $this->fixture('Class_CodifAnnexe', ['id' => 93, - 'libelle' => 'Bd', + $this->fixture('Class_CodifAnnexe', ['id' => 93, + 'libelle' => 'Bd', 'invisible' => 0, 'code' => 93]); - + Class_Album::find(43) ->setCatId(2) ->setBibliotheques('74') @@ -1056,13 +1057,13 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC /** @test */ function formShouldHaveAComboBoxForTypeDocSelection() { - $this->assertXPathContentContains("//select[@name='type_doc_id']//option[@value='200']", + $this->assertXPathContentContains("//select[@name='type_doc_id']//option[@value='200']", 'non identifié'); - $this->assertXPathContentContains("//select[@name='type_doc_id']//option[@value='201']", + $this->assertXPathContentContains("//select[@name='type_doc_id']//option[@value='201']", 'livres'); - $this->assertXPathContentContains("//select[@name='type_doc_id']//option[@selected='selected'][@value='101']", + $this->assertXPathContentContains("//select[@name='type_doc_id']//option[@selected='selected'][@value='101']", 'Diaporama'); } @@ -1094,11 +1095,11 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC /** @test */ function formShouldHaveAComboBoxForLangueSelection() { - $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='cus']", + $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='cus']", 'couchitique'); - $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='fre'][@selected='selected']", + $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='fre'][@selected='selected']", 'français'); - $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='dak']", + $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='dak']", 'dakota'); } @@ -1182,7 +1183,7 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerTestC $this->assertXPath('//input[@name="duration"][@value="00:05:00"]'); } - + /** @test */ public function pageShouldContainsScriptWithAuthorPba() { $this->assertXPathContentContains('//div[@id="multi_inputs_authors"]/following-sibling::script','Pba',$this->_response->getBody()); @@ -1216,7 +1217,7 @@ class Admin_AlbumControllerEditAlbumMesRomans extends Admin_AlbumControllerTestC $this->dispatch('/admin/album/edit_album/id/24'); } - + /** @test */ function formShouldHaveEmptyTagSuggestForMatiere() { $this->assertXPath("//input[@name='matiere'][@value='']"); @@ -1224,11 +1225,11 @@ class Admin_AlbumControllerEditAlbumMesRomans extends Admin_AlbumControllerTestC /** @test */ function formShouldHaveAComboBoxForLangueSelection() { - $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='cus']", + $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='cus']", 'couchitique'); - $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='fre'][@selected='selected']", + $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='fre'][@selected='selected']", 'français'); - $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='dak']", + $this->assertXPathContentContains("//select[@name='id_langue']//option[@value='dak']", 'dakota'); } } @@ -1239,22 +1240,22 @@ class Admin_AlbumControllerPostEditAlbumMesBDTest extends Admin_AlbumControllerT parent::setUp(); $_FILES['fichier'] = ['size' => 0, - 'name' => '', - 'tmp_name' => '', + 'name' => '', + 'tmp_name' => '', 'error' => 4]; - $_FILES['pdf'] = ['size' => 0, - 'name' => '', - 'tmp_name' => '', + $_FILES['pdf'] = ['size' => 0, + 'name' => '', + 'tmp_name' => '', 'error' => 4]; $this->bd = Class_Album::find(43); $this->bd->setNotice( - $this->fixture('Class_Notice', + $this->fixture('Class_Notice', ['id' => 72, 'exemplaires' => [ - $this->fixture('Class_Exemplaire', + $this->fixture('Class_Exemplaire', ['id' => 2])]])) ->save(); @@ -1264,7 +1265,7 @@ class Admin_AlbumControllerPostEditAlbumMesBDTest extends Admin_AlbumControllerT Storm_Cache::setDefaultZendCache($this->cache_mock); Class_CodifAuteur::beVolatile(); - $this->postDispatch('/admin/album/edit_album/id/43', + $this->postDispatch('/admin/album/edit_album/id/43', ['titre' => 'Mes BD', 'description' => "Les préférées de l'année", 'tags' => 'selection', @@ -1400,13 +1401,13 @@ abstract class Admin_AlbumControllerAlbumHarlockTestCase extends Admin_AlbumCont public function setUp() { parent::setUp(); $harlock = $this->fixture( - 'Class_Album', + 'Class_Album', ['id' => 999, 'titre' => 'Harlock', 'id_origine' => 'HL22', 'type_doc_id' => Class_TypeDoc::DIAPORAMA, 'categorie' => $this->fixture('Class_AlbumCategorie', ['id' => 999, 'libelle' => '']), - 'ressources' => [$this->fixture('Class_AlbumRessource', + 'ressources' => [$this->fixture('Class_AlbumRessource', ['id' => 1, 'titre' => 'Arcadia', 'description' => 'Le vaisseau spatial', @@ -1414,19 +1415,44 @@ abstract class Admin_AlbumControllerAlbumHarlockTestCase extends Admin_AlbumCont 'link_to' => '/afi-opac3/cms/viewarticle/id/2', 'matiere' => '999', 'ordre' => 5]), - $this->fixture('Class_AlbumRessource', + $this->fixture('Class_AlbumRessource', ['id' => 2, 'titre' => 'Nausica', 'fichier' => '2.png', 'folio' => '4R', 'ordre' => 1])]]); - + } } +class Admin_AlbumControllerAlbumHarlockPreviewAlbumTest extends Admin_AlbumControllerAlbumHarlockTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/album/preview_album/id/999'); + } + + + /** @test */ + public function pageShouldContainsInputToModifyBoxHeight() { + $this->assertXPath("//input[@id='op_hauteur_boite'][@value=400]"); + } + + + /** @test */ + public function withOpHauteurBoite600InputShouldBeUptodate() { + $this->bootstrap(); + parent::setUp(); + Class_Album::find(999)->setOpHauteurBoite(600); + $this->dispatch('/admin/album/preview_album/id/999'); + $this->assertXPath("//input[@id='op_hauteur_boite'][@value=600]", $this->_response->getBody()); + } +} + + + class Admin_AlbumControllerAlbumHarlockSortRessourcesActionTest extends Admin_AlbumControllerAlbumHarlockTestCase { public function setUp() { parent::setUp(); @@ -1588,7 +1614,7 @@ class Admin_AlbumControllerAlbumHarlockEditRessourceOneActionTest extends Admin_ $this->assertXPathContentContains('//a[contains(@href, "album/edit_images/id/999")]', '002'); } - + /** @test */ public function panelShouldContainsIconSupportForAlbumHarlock() { $this->assertXPath("//div//img[contains(@src, 'images.png')]"); @@ -1641,12 +1667,12 @@ class Admin_AlbumControllerAlbumHarlockEditRessourceOneActionTest extends Admin_ class Admin_AlbumControllerAlbumHarlockPreviewRessourceOneActionTest extends Admin_AlbumControllerAlbumHarlockTestCase { - protected + protected $_tiles_generator; public function setUp() { parent::setUp(); - + Class_AlbumRessource::find(1) ->setTilesGenerator($this->_tiles_generator = Storm_Test_ObjectWrapper::mock() ->whenCalled('ensureTilesGenerated') @@ -1687,7 +1713,7 @@ class Admin_AlbumControllerAlbumHarlockPreviewRessourceOneActionTest extends Adm /** @test */ public function attributionShouldBeArcadia() { - $this->assertXPathContentContains('//script', "\"attribution\":\"Arcadia\""); + $this->assertXPathContentContains('//script', "\"attribution\":\"Arcadia\""); } @@ -1821,7 +1847,7 @@ class Admin_AlbumControllerAlbumHarlockPostRessourceOneActionTest extends Admin_ /** @test */ public function responseShouldRedirectToEditRessourceIdOne() { - $this->assertRedirectTo('/admin/album/edit_ressource/id/1', + $this->assertRedirectTo('/admin/album/edit_ressource/id/1', $this->_response->isRedirect()); } @@ -1858,7 +1884,7 @@ class Admin_AlbumControllerAlbumHarlockPostRessourceOneActionTest extends Admin_ /** @test */ public function shouldNotHaveIndexedAuthorLlaTwice() { - $this->assertEquals(1, + $this->assertEquals(1, substr_count($this->ressource->getAlbum()->getNotice()->getAuteurs(), 'LLA')); } @@ -1866,7 +1892,7 @@ class Admin_AlbumControllerAlbumHarlockPostRessourceOneActionTest extends Admin_ /** @test */ public function shouldNotHaveIndexedAlphaAuthorLlaTwice() { - $this->assertEquals(1, + $this->assertEquals(1, substr_count($this->ressource->getAlbum()->getNotice()->getAlphaAuteur(), 'LLA')); } @@ -1893,7 +1919,7 @@ class Admin_AlbumControllerAlbumHarlocPostErrorsRessourceOneActionTest extends A $this->postDispatch('/admin/album/edit_ressource/id/1', array('link_to' => 'blob')); - $this->assertXPathContentContains("//ul[@class='errors']//li", + $this->assertXPathContentContains("//ul[@class='errors']//li", "'blob' n'est pas une URL valide"); } } @@ -1987,11 +2013,6 @@ class Admin_AlbumControllerPreviewAlbumBibleSouvignyTest extends Admin_AlbumCont $this->assertXPath("//a[contains(@href, 'album/edit_album/id/44')]"); } - /** @test */ - public function pageShouldContainsLinkToModifyBoxHeight() { - $this->assertXPath("//input[contains(@id, 'op_hauteur_boite')]"); - } - /** @test */ public function bookletShouldBeLoaded() { @@ -2155,7 +2176,7 @@ abstract class Admin_AlbumControllerPostImportEADTest extends Admin_AlbumControl class Admin_AlbumControllerPreviewFilmArteVODTest extends Admin_AlbumControllerTestCase { public function setUp() { parent::setUp(); - + Class_Album::getLoader() ->newInstanceWithId(102) ->setTitre('Mulholland drive') @@ -2167,11 +2188,11 @@ class Admin_AlbumControllerPreviewFilmArteVODTest extends Admin_AlbumControllerT array('field' => '856', 'data' => array('x' => 'trailer', 'a' => 'http://media.universcine.com/7e/5b/7e5bece6-7d56-11e1-9d5b-6b449667e8b8.flv')), - + array('field' => '856', 'data' => array('x' => 'poster', 'a' => 'http://media.universcine.com/7e/5c/7e5c210a-b4ad-11e1-b992-959e1ee6d61d.jpg')))); - + $this->dispatch('/admin/album/preview_album/id/102', true); } @@ -2236,7 +2257,7 @@ class Admin_AlbumControllerPreviewFilmArteVODTest extends Admin_AlbumControllerT class Admin_AlbumControllerMassRessourceDeleteActionTest extends Admin_AlbumControllerTestCase { /** @var Storm_Test_ObjectWrapper */ protected $_ressource_wrapper; - + public function setUp() { parent::setUp(); @@ -2270,7 +2291,7 @@ class Admin_AlbumControllerMassRessourceDeleteActionTest extends Admin_AlbumCont public function withValidRessourceShouldDeleteIt() { Class_AlbumRessource::newInstanceWithId(37) ->setAlbum(Class_Album::newInstanceWithId(999)); - + $this->dispatch('/admin/album/mass-ressource-delete/id/999?ids=37', true); $this->assertTrue($this->_ressource_wrapper->methodHasBeenCalled('delete')); } @@ -2280,7 +2301,7 @@ class Admin_AlbumControllerMassRessourceDeleteActionTest extends Admin_AlbumCont public function withRessourceOfAnotherAlbumShouldNotDeleteIt() { Class_AlbumRessource::newInstanceWithId(37) ->setAlbum(Class_Album::newInstanceWithId(7)); - + $this->dispatch('/admin/album/mass-ressource-delete/id/999?ids=37', true); $this->assertTrue($this->_ressource_wrapper->methodHasNotBeenCalled('delete')); } @@ -2304,7 +2325,7 @@ abstract class ControllerAlbumMultiMediasTestCase extends AbstractControllerTest parent::setUp(); $this->_xpath = new Storm_Test_XPathXML(); - + $album = Class_Album::newInstanceWithId(999) ->beDiaporama() ->setTitre('Plein de medias') @@ -2323,7 +2344,7 @@ abstract class ControllerAlbumMultiMediasTestCase extends AbstractControllerTest ->setTitre('Emilie jolie') ->setOrdre(1) ->setPoster('mimi_jolie.png'), - + Class_AlbumRessource::newInstanceWithId(4) ->setFichier('dark_night.mp4') ->setTitre('Batman Dark Knight') @@ -2343,7 +2364,7 @@ abstract class ControllerAlbumMultiMediasTestCase extends AbstractControllerTest ->setTitre('Monsieur l\'escargot') ->setOrdre(4) ->setPoster('l\'escargot.jpg')]); - + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_AlbumCategorie') ->whenCalled('findAllBy') ->answers([]) @@ -2361,7 +2382,7 @@ abstract class ControllerAlbumMultiMediasTestCase extends AbstractControllerTest ->with(['cat_id'=>'33']) ->answers([$album]); - + } } @@ -2374,7 +2395,7 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest $this->dispatch('/admin/album/export-ead', true); } - + /** @test */ public function headerShouldContainsContentTypeXml() { $this->assertHeaderContains('Content-Type', 'application/xml'); @@ -2385,7 +2406,7 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest public function headerShouldContainsContentDispositionAttachment() { $this->assertHeaderContains('Content-Disposition', 'attachment'); } - + /** @test */ public function xmlVersionShouldOneDotZero() { @@ -2401,29 +2422,29 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest /** @test */ public function NumeroDeNoticeShouldBe50() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//ead:archdesc/ead:dsc/ead:c01/ead:did/ead:unitid[contains(@type, "numéro_de_notice")]', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//ead:archdesc/ead:dsc/ead:c01/ead:did/ead:unitid[contains(@type, "numéro_de_notice")]', '50',$this->_response->getBody()); } /** @test */ public function TitreNoticeShouldBePleinDeMedias() { - $this->_xpath->assertXPath($this->_response->getBody(), + $this->_xpath->assertXPath($this->_response->getBody(), '//ead:unitid'); } /** @test */ public function UnitDateShouldBeXXemeSiecle() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//ead:unitdate[1]', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//ead:unitdate[1]', 'XXe siècle',$this->_response->getBody()); } /** @test */ public function langmaterialShouldBeFre() { - $this->_xpath->assertXPath($this->_response->getBody(), + $this->_xpath->assertXPath($this->_response->getBody(), '//ead:archdesc/ead:dsc/ead:c01/ead:did/ead:langmaterial/ead:language[contains(@langcode,"fre")]'); } @@ -2431,8 +2452,8 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest /** @test */ public function physfacetSupportShouldBeParchemin() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//ead:archdesc/ead:dsc/ead:c01/ead:did/ead:physdesc/ead:physfacet[contains(@type,"support")]', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//ead:archdesc/ead:dsc/ead:c01/ead:did/ead:physdesc/ead:physfacet[contains(@type,"support")]', 'Parchemin',$this->_response->getBody()); } @@ -2440,7 +2461,7 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest /** @test */ public function c02TitleShouldBeR2() { - $this->_xpath->assertXPath($this->_response->getBody(), + $this->_xpath->assertXPath($this->_response->getBody(), '//ead:archdesc/ead:dsc/ead:c01/ead:c02[contains(@id,"R2")]', $this->_response->getBody()); } @@ -2449,7 +2470,7 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest public function xmlShouldBeValid() { $dom = new DOMDocument(); $dom->loadXml($this->_response->getBody()); - + $dom->schemaValidate('tests/application/modules/opac/controllers/ead.xsd'); } diff --git a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php index 920efbb55f21cb32b43b7e7b3f92824376b049d9..67bc992e9136e8ceef6b4ef23b153405111d369a 100644 --- a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php +++ b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 'AbstractControllerTestCase.php'; @@ -45,22 +45,23 @@ abstract class AbstractBibNumeriqueControllerAlbumActionPremierVolumeTestCase ex public function setUp() { parent::setUp(); - - $this->_album = $this->fixture('Class_Album', + + $this->_album = $this->fixture('Class_Album', ['id' => 999, 'titre' => 'Premier volume', 'description' => "On ne peut que reconnaitre le talent de l'artiste !", 'thumbnail_width' => 200, 'thumbnail_left_page_crop_right' => 10, 'thumbnail_right_page_crop_top' => 5, + 'op_hauteur_boite' => 500, 'id_origine' => 'DC23', 'pdf' => 'volume1.pdf', 'notice' => $this->fixture('Class_Notice', ['id' => 123])]); $this->_album ->beDiaporama() - ->setCategorie($this->fixture('Class_AlbumCategorie', - ['id' => 2, + ->setCategorie($this->fixture('Class_AlbumCategorie', + ['id' => 2, 'libelle' => 'Les enluminures', 'parent_categorie' => $this->fixture('Class_AlbumCategorie', ['id' => 3, @@ -77,7 +78,7 @@ abstract class AbstractBibNumeriqueControllerAlbumActionPremierVolumeTestCase ex 'image' => $im, 'folio' => '1R3', 'album' => $this->_album]), - + $this->fixture('Class_AlbumRessource', ['id' => 2, 'fichier' => '2.jpg', 'album' => $this->_album, @@ -184,7 +185,7 @@ class BibNumeriqueControllerAlbumPremierVolumeTestToJSON extends AbstractBibNume /** @test */ function secondRessourceTitreShouldBeProcedureDeNumerisation() { $this->assertEquals('Procedure de numerisation', $this->json->album->ressources[1]->titre); - + } @@ -363,7 +364,7 @@ class BibNumeriqueControllerBookletTest extends AbstractBibNumeriqueControllerAl /** @test */ function pageShouldContainsCodeToOpenBooklet() { - $this->assertXPathContentContains('//script', + $this->assertXPathContentContains('//script', "smalltalk.BibNumAlbum._load_in_scriptsRoot_('/bib-numerique/album/id/999.json', '#booklet_999', '" . BASE_URL . "/amber/afi/souvigny/')", $this->_response->getBody()); } @@ -376,7 +377,7 @@ class BibNumeriqueControllerViewAlbumActionPremierVolumeTest extends AbstractBib public function setUp() { parent::setUp(); Class_Profil::getCurrentProfil()->setSkin('original'); - $this->dispatch('/opac/bib-numerique/view-album/id/999'); + $this->dispatch('/opac/bib-numerique/view-album/id/999', true); } @@ -404,6 +405,12 @@ class BibNumeriqueControllerViewAlbumActionPremierVolumeTest extends AbstractBib } + /** @test */ + public function hauteurBoiteShouldBeSetTo500() { + $this->assertXPathContentContains('//script', '"height":"500"'); + } + + /** @test */ public function viewerScriptShouldBePresent() { $this->assertXPath('//script[contains(@src, "prettyPhoto.js")]'); @@ -443,7 +450,7 @@ class BibNumeriqueControllerViewCategorieActionTest extends AbstractControllerTe class BibNumeriqueControllerViewCategorieActionLesEnluminuresTest extends AbstractControllerTestCase { public function setUp() { parent::setUp(); - + Class_AlbumCategorie::getLoader() ->newInstanceWithId(2) ->setLibelle('Les enluminures') @@ -455,7 +462,7 @@ class BibNumeriqueControllerViewCategorieActionLesEnluminuresTest extends Abstra ->setTitre('Premier volume') ->setFichier('999.jpg') ->setDescription('On ne peut que reconnaitre le talent de l\'artiste !'))); - + $this->dispatch('/opac/bib-numerique/view-categorie/id/2'); } @@ -490,7 +497,7 @@ class BibNumeriqueControllerViewCategorieActionLesEnluminuresTest extends Abstra abstract class BibNumeriqueControllerBibleDeSouvignyTestCase extends AbstractControllerTestCase { public function setUp() { parent::setUp(); - + Class_AlbumCategorie::getLoader() ->newInstanceWithId(3) ->setLibelle('La bible de souvigny') @@ -540,7 +547,7 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo parent::setUp(); $this->_xpath = new Storm_Test_XPathXML(); - + $album = Class_Album::newInstanceWithId(999) ->beDiaporama() ->setTitre('Plein de medias') @@ -565,7 +572,7 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo ->setTitre('Emilie jolie') ->setOrdre(1) ->setPoster('mimi_jolie.png'), - + Class_AlbumRessource::newInstanceWithId(4) ->setFichier('dark_night.mp4') ->setTitre('Batman Dark Knight') @@ -596,11 +603,11 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo ->setTitre('Iron Maiden: "Moonchild" live') ->setOrdre(6) ->setPoster('moonchild.jpg'), - + Class_AlbumRessource::newInstanceWithId(9) ->setFichier('the_prophecy.mp3') ->setOrdre(7)]); - + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_AlbumCategorie') ->whenCalled('findAllBy') ->answers([]) @@ -618,7 +625,7 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo ->with(['cat_id'=>'33']) ->answers([$album]); - + } } @@ -632,7 +639,7 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl $this->dispatch('/opac/bib-numerique/album-xspf-playlist/id/999.xspf', true); } - + /** @test */ public function headerShouldContainsContentTypeXspf() { $this->assertHeaderContains('Content-Type', 'application/xspf+xml'); @@ -643,7 +650,7 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl public function headerShouldContainsContentDispositionAttachment() { $this->assertHeaderContains('Content-Disposition', 'attachment'); } - + /** @test */ public function xmlVersionShouldOneDotZero() { @@ -659,39 +666,39 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl /** @test */ public function firstTrackTitleShouldBeMimiJolie() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//xspf:playlist/xspf:trackList/xspf:track/xspf:title', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//xspf:playlist/xspf:trackList/xspf:track/xspf:title', 'Emilie jolie'); } /** @test */ public function firstTrackImageShouldBeMimiJolieDotPng() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//xspf:playlist/xspf:trackList/xspf:track/xspf:image', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//xspf:playlist/xspf:trackList/xspf:track/xspf:image', 'http://localhost' . BASE_URL . '/userfiles/album/999/thumbs/media/mimi_jolie.png'); } /** @test */ public function firstTrackLocationShouldBeMimiJolieDotMp3() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//xspf:playlist/xspf:trackList/xspf:track/xspf:location', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//xspf:playlist/xspf:trackList/xspf:track/xspf:location', 'http://localhost' . BASE_URL . '/bib-numerique/play-ressource/id/6.mp3'); } /** @test */ public function secondTrackTitleShouldBeBatmanDarkKnight() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//xspf:playlist/xspf:trackList/xspf:track/xspf:title', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//xspf:playlist/xspf:trackList/xspf:track/xspf:title', 'Batman Dark Knight'); } /** @test */ public function thirdTrackLocationShouldBeTotaleClipsDotCom() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), + $this->_xpath->assertXPathContentContains($this->_response->getBody(), '//xspf:playlist/xspf:trackList/xspf:track/xspf:location', 'http://localhost' . BASE_URL . '/bib-numerique/play-ressource/id/5.mp4'); } @@ -699,16 +706,16 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl /** @test */ public function fourthTrackLocationShouldBeUrlEncoded() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//xspf:playlist/xspf:trackList/xspf:track/xspf:location', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//xspf:playlist/xspf:trackList/xspf:track/xspf:location', 'play-ressource/id/2.mp3'); } /** @test */ public function seventhTrackTitleShouldBeTheProphecy() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//xspf:playlist/xspf:trackList/xspf:track/xspf:title', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//xspf:playlist/xspf:trackList/xspf:track/xspf:title', 'The prophecy'); } @@ -716,8 +723,8 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl /** @test */ public function vimeoTrackLocationShouldBeOriginalUrl() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), - '//xspf:playlist/xspf:trackList/xspf:track/xspf:location', + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//xspf:playlist/xspf:trackList/xspf:track/xspf:location', 'https://vimeo.com/43395780'); } } @@ -755,7 +762,7 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll /** @test */ public function titleShouldBePleinDeMedias() { - $this->_xpath->assertXPathContentContains($this->_response->getBody(), + $this->_xpath->assertXPathContentContains($this->_response->getBody(), '//channel/title', 'Plein de medias'); } @@ -763,7 +770,7 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll /** @test */ public function itunesImageShouldBeNoticeThumbnail() { - $this->_xpath->assertXPath($this->_response->getBody(), + $this->_xpath->assertXPath($this->_response->getBody(), '//channel/itunes:image[@href="http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/ido/A888"]'); } @@ -792,7 +799,7 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll } - + /** @test */ public function pubDateShouldBeFri17Feb2012() { $this->_xpath->assertXPathContentContains($this->_response->getBody(), @@ -902,13 +909,13 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu } - /** - * @test + /** + * @test * @depends forRessourceFiveShouldRedirectToTotaleClipsDotCom */ public function forRessourceFiveAnalyticsTrackerShouldHaveReceivedPlayEvent($client) { - $this->assertEquals(['bib-numerique', - 'lecture', '"titre: Hunger Games","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 3","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/5.mp3/ido/A888/folio/5"', + $this->assertEquals(['bib-numerique', + 'lecture', '"titre: Hunger Games","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 3","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/5.mp3/ido/A888/folio/5"', 5], $client->getAttributesForLastCallOn('trackEvent')); } @@ -921,13 +928,13 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu } - /** - * @test + /** + * @test */ public function forRessourceMoonchildAnalyticsTrackerShouldEscapeQuotes() { $this->dispatch('/opac/bib-numerique/play-ressource/id/8.mp3', true); - $this->assertEquals(['bib-numerique', - 'lecture', + $this->assertEquals(['bib-numerique', + 'lecture', '"titre: Iron Maiden: \"Moonchild\" live","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 6","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/8.mp3/ido/A888/folio/moonchild"', 8], $this->_web_analytics_client->getAttributesForLastCallOn('trackEvent')); @@ -938,7 +945,7 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu class BibNumeriqueControllerFullScreenEpubTest extends BibNumeriqueControllerAlbumMultiMediasTestCase { - protected + protected $_path_epub_temp; public function setUp() {