diff --git a/VERSIONS_HOTLINE/141934 b/VERSIONS_HOTLINE/141934 new file mode 100644 index 0000000000000000000000000000000000000000..637d4b40b99692f0a6e2bf61ec8d56aaa22732b0 --- /dev/null +++ b/VERSIONS_HOTLINE/141934 @@ -0,0 +1 @@ + - correctif #141934 : Magasin de thèmes : Correction du lien en lire plus dans les carousels des articles. \ No newline at end of file diff --git a/application/modules/opac/controllers/WidgetController.php b/application/modules/opac/controllers/WidgetController.php index 52de1f535ad581d205db93fe9f7c94bd609484bd..f5f549dac7bd88ee0162d3f30fb66d1c40a32fbd 100644 --- a/application/modules/opac/controllers/WidgetController.php +++ b/application/modules/opac/controllers/WidgetController.php @@ -46,18 +46,23 @@ class WidgetController extends ZendAfi_Controller_Action { public function renderAllAction() { - if (!$id = $this->_getParam('widget_id')) + if ( $article = Class_Article::find($this->_getParam('article_id', null))) + return $this->view->widget = (new Class_Article_Widget($article, + $this->_getParam('widget_key'))) + ->getWidget(); + + if ( !$id = $this->_getParam('widget_id')) return $this->getResponse()->setHttpResponseCode(404); - if (!$profile_id = $this->_getParam('profile_id')) + if ( !$profile_id = $this->_getParam('profile_id')) return $this->getResponse()->setHttpResponseCode(404); Class_Template::setCurrentFrom($profile_id); - if (!$widget = ((new Class_Systeme_Widget_Widget) - ->setId($id) - ->setProfileId($profile_id) - ->load())) + if ( !$widget = ((new Class_Systeme_Widget_Widget) + ->setId($id) + ->setProfileId($profile_id) + ->load())) return $this->getResponse()->setHttpResponseCode(404); $this->view->widget = $widget; diff --git a/library/Class/Article.php b/library/Class/Article.php index f3dd9ecf2734168cf2856fbfb1fa33bc98f2e9bc..1858f24725b1b5777a9207867d1aeafa01d68821 100644 --- a/library/Class/Article.php +++ b/library/Class/Article.php @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + class Class_Article extends Storm_Model_Abstract { use Trait_Translator, @@ -82,7 +83,6 @@ class Class_Article extends Storm_Model_Abstract { 'auteur' => ['model' => Class_Users::class, 'referenced_in' => 'id_user']]; - protected $_overrided_attributes = ['id', 'id_article', 'parent_id', @@ -93,32 +93,32 @@ class Class_Article extends Storm_Model_Abstract { 'contenu', 'refus_message']; - protected $_default_attribute_values = [ - 'id_notice' => null, - 'titre' => '', - 'description' => '', - 'contenu' => '', - 'debut' => null, - 'fin' => null, - 'avis' => false, - 'tags' => '', - 'events_debut' => null, - 'events_fin' => null, - 'indexation' => 1, - 'cacher_titre' => 0, - 'date_maj' => '', - 'date_creation' => '', - 'status' => self::STATUS_DRAFT, - 'id_lieu' => 0, - 'id_cat' => 0, - 'domaine_ids' => '', - 'id_origine' => 0, - 'parent_id' => 0, - 'repository_origine' => '', - 'refus_message' => '', - 'destination_email' => '', - 'all_day' => false, - 'pick_day' => null]; + protected $_default_attribute_values = + ['id_notice' => null, + 'titre' => '', + 'description' => '', + 'contenu' => '', + 'debut' => null, + 'fin' => null, + 'avis' => false, + 'tags' => '', + 'events_debut' => null, + 'events_fin' => null, + 'indexation' => 1, + 'cacher_titre' => 0, + 'date_maj' => '', + 'date_creation' => '', + 'status' => self::STATUS_DRAFT, + 'id_lieu' => 0, + 'id_cat' => 0, + 'domaine_ids' => '', + 'id_origine' => 0, + 'parent_id' => 0, + 'repository_origine' => '', + 'refus_message' => '', + 'destination_email' => '', + 'all_day' => false, + 'pick_day' => null]; public function describeAssociationsOn($associations) { @@ -551,11 +551,11 @@ class Class_Article extends Storm_Model_Abstract { '$1 action="'. $action .'" method="POST" '], $contenu); - $end_form = '</form>'; $antispam_tag = '<input data-spambots="true" autocomplete="off" name="website" type="text" />'; $replaced_form = str_replace($antispam_tag, '', $replaced_form); + if (false === strpos($replaced_form, 'name="website"')) $replaced_form = preg_replace('|' . $end_form .'|i', $antispam_tag . $end_form, @@ -565,6 +565,7 @@ class Class_Article extends Storm_Model_Abstract { $namesubmit = 'name='.$quoted_value; $otherattributes = '[^>]+'; $inputtag = '<input'; + return preg_replace([ '/('.$inputtag.$otherattributes.')('.$typesubmit.$otherattributes.')'.$namesubmit.'/i', '/('.$inputtag.$otherattributes.')'.$namesubmit.'('.$otherattributes.$typesubmit.')/i', '/('.$inputtag.$otherattributes.')'.$typesubmit.'('.$otherattributes.')\/>/i' ], @@ -572,7 +573,6 @@ class Class_Article extends Storm_Model_Abstract { '$1$2', '$1$2type="submit"/>'], $replaced_form); - } @@ -617,13 +617,26 @@ class Class_Article extends Storm_Model_Abstract { } - public function getFirstCarouselData() { + public function getFirstCarouselData() : array { + return $this->_getCarouselData('preg_match'); + } + + + public function getAllCarouselsData() { + return $this->_getCarouselData('preg_match_all'); + } + + + protected function _getCarouselData(string $preg_function) : array { $matches = []; - if (preg_match('|(?P<allimg><img[^>]+data-code="(?P<code>\w+)"[^>]+data-form="(?P<form>[^"]+)[^>]*>)|', $this->getSummary(), $matches) > 0) - return $matches; + $expression = '|(?P<allimg><img[^>]+data-code="(?P<code>\w+)"[^>]+data-form="(?P<form>[^"]+)[^>]*>)|'; - return []; + return $preg_function($expression, + $this->getSummary(), + $matches) > 0 + ? $matches + : []; } diff --git a/library/Class/Article/Widget.php b/library/Class/Article/Widget.php new file mode 100644 index 0000000000000000000000000000000000000000..06db5160e1c13bf0dfb0ac570c74aa9ef92ba762 --- /dev/null +++ b/library/Class/Article/Widget.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright (c) 2012-2022, 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 Class_Article_Widget { + + + protected $_article; + protected $_widget_cache_key = ''; + + + public function __construct(Class_Article $article, string $widget_cache_key) { + $this->_widget_cache_key = $widget_cache_key; + $this->_article = $article; + } + + + public function getWidget() : Class_Systeme_Widget_Widget { + return (new Class_Systeme_Widget_Widget) + ->loadFromSettings($this->_getSettings()); + } + + + protected function _getSettings() : array { + if ( ! $data = $this->_article->getAllCarouselsData()) + return []; + + if ( ! isset($data['code'])) + return []; + + if ( ! isset($data['form'])) + return []; + + foreach ($data['code'] as $key => $code) + if ($settings = $this->_getSettingsFromCarouselData($data, $key, $code)) + return $settings; + + return []; + } + + + protected function _getSettingsFromCarouselData(array $data, + string $key, + string $code) : array { + $prefs = []; + parse_str(html_entity_decode($data['form'][$key]), $prefs); + + return + ($this->_widget_cache_key == + Intonation_Library_Widget_Carousel_View::hashArray($prefs)) + ? ['type_module' => $code, + 'preferences' => $prefs] + : []; + } +} diff --git a/library/Class/Systeme/Widget/Abstract.php b/library/Class/Systeme/Widget/Abstract.php index ffd914ee7247faf36d652bcc4e617956fee73157..560eefb0fff5215bce0ac7927a5814ad383d5f40 100644 --- a/library/Class/Systeme/Widget/Abstract.php +++ b/library/Class/Systeme/Widget/Abstract.php @@ -42,17 +42,17 @@ abstract class Class_Systeme_Widget_Abstract extends Class_Entity { $_disable_fonction_admin = false; - public function load() { + public function load() : ?Class_Systeme_Widget_Abstract { $cache_key = $this->_getCacheKey(); if (isset(static::$_loaded_instances[$cache_key])) return static::$_loaded_instances[$cache_key]; - if (!$this->init()) - return; + if ( ! $this->init()) + return null; - if (!$this->_load()) - return; + if ($this->_load()->_isNull()) + return null; $this ->setTitle($this->_getTitle()) @@ -63,6 +63,12 @@ abstract class Class_Systeme_Widget_Abstract extends Class_Entity { } + protected function _isNull() : bool { + return get_class($this->getResourcesDefinition()) + == Class_Systeme_ModulesAccueil_Null::class; + } + + public function setViewHelper($view_helper) { return $this->set('ViewHelper', $view_helper); } @@ -194,12 +200,12 @@ abstract class Class_Systeme_Widget_Abstract extends Class_Entity { } - protected function _transmute($attributes) { + protected function _transmute(array $attributes) : self { if(empty($attributes)) - return null; + return $this; if((!isset($attributes['type_menu'])) && (!isset($attributes['type_module']))) - return null; + return $this; $this->setResourcesDefinition($this->_getResourcesDefinition(isset($attributes['type_menu']) ? $attributes['type_menu'] @@ -282,8 +288,8 @@ abstract class Class_Systeme_Widget_Abstract extends Class_Entity { } - protected function _load() { - return []; + protected function _load() : self { + return $this; } diff --git a/library/Class/Systeme/Widget/Action.php b/library/Class/Systeme/Widget/Action.php index b6f9d1ddd69ce0ba3f1be689b8c08eae906bcb12..6846c716b6b2b676531144984ad34ecd61c6877b 100644 --- a/library/Class/Systeme/Widget/Action.php +++ b/library/Class/Systeme/Widget/Action.php @@ -23,12 +23,12 @@ class Class_Systeme_Widget_Action extends Class_Systeme_Widget_Abstract { - protected function _load() { + protected function _load() : self { return $this->_transmute($this->_findLeaf($this->getId())); } - protected function _transmute($attributes) { + protected function _transmute(array $attributes) : self { $attributes = $this->_getValues($attributes); $this->updateAttributes($attributes); diff --git a/library/Class/Systeme/Widget/Menu.php b/library/Class/Systeme/Widget/Menu.php index e78cb8d827a8b48dbb4f83d0ce7eb258c5aa651d..ab695136c79549d62bff44246ff6a6ad8a8470e5 100644 --- a/library/Class/Systeme/Widget/Menu.php +++ b/library/Class/Systeme/Widget/Menu.php @@ -135,7 +135,7 @@ class Class_Systeme_Widget_Menu extends Class_Systeme_Widget_Abstract { } - protected function _load() { + protected function _load() : self { return $this->_transmute($this->find()); } diff --git a/library/Class/Systeme/Widget/Section.php b/library/Class/Systeme/Widget/Section.php index 415eea7607afb838ba16cf99a6300307ada40492..030b607e5978365397cfbd50b7d49b9e8cb01e8a 100644 --- a/library/Class/Systeme/Widget/Section.php +++ b/library/Class/Systeme/Widget/Section.php @@ -22,12 +22,12 @@ class Class_Systeme_Widget_Section extends Class_Systeme_Widget_Abstract { - protected function _load() { + protected function _load() : self { return $this->_transmute($this->_findLeaf($this->getId())); } - protected function _transmute($attributes) { + protected function _transmute(array $attributes) : self { $attributes = $this->_getValues($attributes); $this->updateAttributes($attributes); diff --git a/library/Class/Systeme/Widget/Widget.php b/library/Class/Systeme/Widget/Widget.php index cbfe128412451fd16463632053978aafe5728686..ae98352fc3c0256fff165d62434949247682c64f 100644 --- a/library/Class/Systeme/Widget/Widget.php +++ b/library/Class/Systeme/Widget/Widget.php @@ -23,7 +23,7 @@ class Class_Systeme_Widget_Widget extends Class_Systeme_Widget_Abstract { - protected function _load() { + protected function _load() : self { return $this->_transmute($this->_findLeaf($this->getId())); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/View.php b/library/templates/Intonation/Library/Widget/Carousel/View.php index 28d869f9c0c9e81a72e686a7da698fa1c9b58b64..6bcc1b661a3ce10c630843566c2b9d54663273ed 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/View.php @@ -26,8 +26,7 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help protected static $_helper_by_layout = - [ - Intonation_Library_Widget_Carousel_Definition::WALL => Intonation_View_RenderWall::class, + [Intonation_Library_Widget_Carousel_Definition::WALL => Intonation_View_RenderWall::class, Intonation_Library_Widget_Carousel_Definition::CAROUSEL => Intonation_View_RenderCarousel::class, Intonation_Library_Widget_Carousel_Definition::LISTING => Intonation_View_RenderList::class, Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS => Intonation_View_RenderTruncateList::class, @@ -37,8 +36,8 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help Intonation_Library_Widget_Carousel_Definition::GRID => Intonation_View_RenderWallGrid::class, Intonation_Library_Widget_Carousel_Definition::MAP => Intonation_View_RenderMap::class, Intonation_Library_Widget_Carousel_Definition::ACCORDION_CAROUSEL => Intonation_View_RenderAccordionCarousel::class, - Intonation_Library_Widget_Carousel_Definition::TIMELINE => Intonation_View_RenderTimeline::class - ]; + Intonation_Library_Widget_Carousel_Definition::TIMELINE => Intonation_View_RenderTimeline::class]; + protected $_layout_helper; @@ -304,11 +303,35 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help null, true); - return $this->view->url(['module' => 'opac', - 'controller' => 'widget', - 'action' => 'render-all', - 'profile_id' => Class_Profil::getCurrentProfil()->getId(), - 'widget_id' => $this->getId()], null, true); + return $this->view->url($this->_getLinkToAllUrlParams(), null, true); + } + + + protected function _getLinkToAllUrlParams() : array { + $url_params = + ['module' => 'opac', + 'controller' => 'widget', + 'action' => 'render-all', + 'profile_id' => Class_Profil::getCurrentProfil()->getId()]; + + if ( isset($this->view->article) && $this->view->article instanceof Class_Article) { + $url_params ['article_id'] = $this->view->article->getId(); + $url_params ['widget_key'] = $this->_getWidgetKey(); + return $url_params; + } + + $url_params ['widget_id'] = $this->getId(); + return $url_params; + } + + + protected function _getWidgetKey() : string { + return static::hashArray($this->_settings->getPreferences()); + } + + + public static function hashArray(array $data) : string { + return md5(serialize($data)); } diff --git a/library/templates/Intonation/View/RenderWidgetAll.php b/library/templates/Intonation/View/RenderWidgetAll.php index 883f95d78e3997aea4f1e2b29395c07c7ddede86..3c1c08b09c6e4ea2f9a294355ad4e3cc6363e7b0 100644 --- a/library/templates/Intonation/View/RenderWidgetAll.php +++ b/library/templates/Intonation/View/RenderWidgetAll.php @@ -26,9 +26,11 @@ class Intonation_View_RenderWidgetAll extends ZendAfi_View_Helper_BaseHelper { return ''; $view_helper = $widget->getViewHelper(); - $view_helper_instance = ZendAfi_View_Helper_Accueil_Base::getWidget($widget->getId(), - $widget->forForm(), - $this->view); + if ( ! $view_helper_instance = + ZendAfi_View_Helper_Accueil_Base::getWidget($widget->getId(), + $widget->forForm(), + $this->view)) + return ''; $html = [$this->view->div(['class' => 'col-12'], $this->view->tag('h1', $view_helper_instance->getTitre())), diff --git a/tests/application/modules/admin/controllers/WidgetControllerTest.php b/tests/application/modules/admin/controllers/WidgetControllerTest.php index 98f55aff1abc252d8f787b524e9c6ac6e1adf671..f0690d12a1b459e02f11daceda80dea64ddcb02c 100644 --- a/tests/application/modules/admin/controllers/WidgetControllerTest.php +++ b/tests/application/modules/admin/controllers/WidgetControllerTest.php @@ -2222,10 +2222,13 @@ class WidgetControllerAddActionPostDispatchTest extends WidgetControllerWidgetCo class WidgetControllerDeleteActionTest extends WidgetControllerWidgetConfigurationTestCase { + + protected $_type_module = 'KIOSQUE'; + + public function setUp() { parent::setUp(); - $this->dispatch('admin/widget/delete/id/6/division/3/id_profil/5', true); - Class_Profil::clearCache(); + $this->dispatch('admin/widget/delete/id/6/division/3/id_profil/5'); } @@ -2235,9 +2238,15 @@ class WidgetControllerDeleteActionTest extends WidgetControllerWidgetConfigurati } + /** @test */ + public function notificationShouldContainsBoiteKiosqueSupprimee() { + $this->assertFlashMessengerContentContains('La boite Boite kiosque a été supprimée'); + } + + /** @test */ public function widgetSixShouldHaveBeenRemoved() { - $this->assertEquals([], $this->_profil->getCfgAccueilAsArray()['modules']); + $this->assertEquals([], Class_Profil::find(5)->getCfgAccueilAsArray()['modules']); } } diff --git a/tests/scenarios/Templates/TemplatesArticlesTest.php b/tests/scenarios/Templates/TemplatesArticlesTest.php index 3920c5f235506b936820cd6dc5f8439af89aaaf6..a2bf4bcd3148362d2ff2615c1e824eb3de4607f5 100644 --- a/tests/scenarios/Templates/TemplatesArticlesTest.php +++ b/tests/scenarios/Templates/TemplatesArticlesTest.php @@ -494,16 +494,16 @@ class TemplatesArticlesMapTest extends TemplatesArticlesWithLocationTestCase { ZendAfi_Auth::getInstance()->clearIdentity(); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') - ->whenCalled('getArticlesByPreferences') - ->answers([Class_Article::find(7), Class_Article::find(8)]); + ->whenCalled('getArticlesByPreferences') + ->answers([Class_Article::find(7), Class_Article::find(8)]); Class_Profil::find(1) - ->setBoiteOfTypeInDivision(3, - Intonation_Library_Widget_Carousel_Article_Definition::CODE, - ['layout' => Intonation_Library_Widget_Carousel_Definition::MAP, - 'titre' => 'event map', - 'id_items' => '7;8']) - ->assertSave(); + ->setBoiteOfTypeInDivision(3, + Intonation_Library_Widget_Carousel_Article_Definition::CODE, + ['layout' => Intonation_Library_Widget_Carousel_Definition::MAP, + 'titre' => 'event map', + 'id_items' => '7;8']) + ->assertSave(); $this->dispatch('/opac/index/index/id_profil/1'); } @@ -630,7 +630,7 @@ class TemplatesArticlesRenderWithDescriptionLengthTest extends AbstractControlle 'id_items' => '9', 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, 'description_length' => $description_length - ] + ] ); $this->dispatch('/opac/index/index/id_profil/1'); @@ -652,7 +652,7 @@ class TemplatesArticlesRenderWithDescriptionLengthTest extends AbstractControlle 'order' => 'Selection', 'id_items' => '9', 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, - ] + ] ); $this->dispatch('/opac/index/index/id_profil/1'); @@ -877,7 +877,6 @@ class TemplatesArticlesWidgetAjaxRenderingWithOrdersTest extends TemplatesArticl - abstract class TemplatesArticlesWithWidgetRenderWallTestCase extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; @@ -888,10 +887,17 @@ abstract class TemplatesArticlesWithWidgetRenderWallTestCase extends AbstractCon $this->_logAdmin(); - $this->fixture('Class_Article', [ 'id' => 55, - 'titre' => 'Mes dvds', - 'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&">']); + $this->fixture(Class_Article::class, + [ 'id' => 55, + 'titre' => 'Mes dvds', + 'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=123&"> +<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=124&">']); + + $this->_dispatch(); + } + + protected function _dispatch() { $this->dispatch('/cms/articleview/id/55'); } @@ -955,7 +961,7 @@ class TemplatesArticlesWithWidgetRenderWallNotLoggedTest 'size' => 9, 'rss' => '1', 'embeded_code' => false, - 'link_to_all' => false, + 'link_to_all' => '1', 'all_layout' => 'list', 'all_rendering' => 'card-horizontal', 'description_length' => 20, @@ -970,15 +976,91 @@ class TemplatesArticlesWithWidgetRenderWallNotLoggedTest 'boite' => '', 'rss' => '1', 'MybibappShowFooter' => '1', + 'link_to_all' => '1', + 'id_panier' => '123', ], 'style_liste' => 'mur', 'aleatoire' => '1', - 'tri' => '1' + 'tri' => '1', + 'id_panier' => '123' ]; $key = md5(json_encode($expected_settings)); $this->assertXPath('//a[contains(@href, "rss/kiosque?id_profil=32&language=fr&cache_key=' . $key . '")]'); } + + + /** @test */ + public function enLirePlusShouldBePresentForFirstCarousel() { + $this->assertXPathContentContains('//div//a[contains(@href, "/widget/render-all/profile_id/32/article_id/55/widget_key/e6871b8faf022fd81b4a3e18ad734eb8")]', 'En lire plus'); + } + + + /** @test */ + public function enLirePlusShouldBePresentForSecondCarousel() { + $this->assertXPathContentContains('//div//a[contains(@href, "/widget/render-all/profile_id/32/article_id/55/widget_key/5d2c8a1b42d7d4e33d4b8a9e7300f3a9")]', 'En lire plus'); + } +} + + + + +class TemplatesArticlesRenderAllFromArticleTest + extends TemplatesArticlesWithWidgetRenderWallTestCase { + + protected $_storm_default_to_volatile = true; + + + protected function _dispatch() {} + + + /** @test */ + public function shouldContainsTrollsDeTroy() { + $trolls = + $this->fixture(Class_Notice::class, + ['id' => 15, + 'clef_chapeau' => 'TROLLS DE TROY', + 'clef_alpha' => 'TROLLS DE TROY ENQUETE POUR LES TROYENS', + 'tome_alpha' => 2, + 'type_doc' => Class_TypeDoc::LIVRE]) + ->set_subfield('461', 't', 'TROLLS DE TROY'); + + $this->fixture(Class_PanierNotice::class, + ['id' => 123, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011', + 'notices' => 'COMBAT ORDINAIRE;BLACKSAD']) + ->addNotice($trolls); + + $this->dispatch('/widget/render-all/profile_id/32/article_id/55/widget_key/e6871b8faf022fd81b4a3e18ad734eb8'); + + $this->assertXPathContentContains('//div[@data-action="widget_render-all"]//div[@class="card-title"]', + 'TROLLS DE TROY'); + } + + + /** @test */ + public function shouldContainsRecordTrollsDeTroy2() { + $trolls = + $this->fixture(Class_Notice::class, + ['id' => 15, + 'clef_chapeau' => 'TROLLS DE TROY 2', + 'clef_alpha' => 'TROLLS DE TROY ENQUETE POUR LES TROYENS 2', + 'tome_alpha' => 3, + 'type_doc' => Class_TypeDoc::LIVRE]) + ->set_subfield('461', 't', 'TROLLS DE TROY 2'); + + $this->fixture(Class_PanierNotice::class, + ['id' => 124, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011']) + ->addNotice($trolls); + + $this->dispatch('/widget/render-all/profile_id/32/article_id/55/widget_key/5d2c8a1b42d7d4e33d4b8a9e7300f3a9'); + + $this->assertXPathContentContains('//div[@data-action="widget_render-all"]//div[@class="card-title"]', + 'TROLLS DE TROY 2'); + } } @@ -1077,7 +1159,7 @@ class TemplatesArticlesWithLibraryUrlRewriteTest extends AbstractControllerTestC /** @test */ public function linkToAnnecyShouldBeAnnecy() { $this->assertXPathContentContains('//a[contains(@href,"/annecy")][contains(@class,"badge_article_library")]', - 'Annecy',$this->_response->getBody()); + 'Annecy'); } }