From 1e5d3a616e618639a259d2b0942042efabc33674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ANDRE=20s=C3=A9bastien?= <sandre@afi-sa.fr> Date: Tue, 12 Oct 2021 14:36:54 +0200 Subject: [PATCH] hotline #138802 fix pro carts table date sorting --- VERSIONS_HOTLINE/138802 | 1 + .../opac/controllers/PanierController.php | 5 +- .../opac/views/scripts/panier/domain.phtml | 5 +- .../opac/views/scripts/panier/pro.phtml | 8 +- library/Class/TableDescription/Carts.php | 176 ++++++++++++++++++ .../Class/TableDescription/CartsOthers.php | 30 +++ .../View/Helper/Admin/RenderTestMyOpac.php | 14 +- library/ZendAfi/View/Helper/Panier/Table.php | 107 +---------- .../View/Helper/Panier/TableOthers.php | 30 +++ .../ZendAfi/View/Helper/Panier/Viewauteur.php | 2 +- .../opac/controllers/PanierControllerTest.php | 159 +++++++++++++++- 11 files changed, 420 insertions(+), 117 deletions(-) create mode 100644 VERSIONS_HOTLINE/138802 create mode 100644 library/Class/TableDescription/Carts.php create mode 100644 library/Class/TableDescription/CartsOthers.php create mode 100644 library/ZendAfi/View/Helper/Panier/TableOthers.php diff --git a/VERSIONS_HOTLINE/138802 b/VERSIONS_HOTLINE/138802 new file mode 100644 index 00000000000..e772777610d --- /dev/null +++ b/VERSIONS_HOTLINE/138802 @@ -0,0 +1 @@ + - ticket #138802 : Administration : correction du tri par date du tableau des paniers des professionnels et des paniers par domaines. \ No newline at end of file diff --git a/application/modules/opac/controllers/PanierController.php b/application/modules/opac/controllers/PanierController.php index 730b75931d9..ee3db0c5a8f 100644 --- a/application/modules/opac/controllers/PanierController.php +++ b/application/modules/opac/controllers/PanierController.php @@ -51,7 +51,8 @@ class PanierController extends ZendAfi_Controller_Action { public function proAction() { - $this->_indexJob(null, Class_PanierNotice::findAllBelongsToAdmin()); + $panier = Class_PanierNotice::find($this->_getParam("id_panier", 0)); + $this->_indexJob($panier, Class_PanierNotice::findAllBelongsToAdmin()); } @@ -331,4 +332,4 @@ class PanierController extends ZendAfi_Controller_Action { $this->view->name = $user->getNomAff(); $this->_indexJob($panier, $user->getPaniers()); } -} \ No newline at end of file +} diff --git a/application/modules/opac/views/scripts/panier/domain.phtml b/application/modules/opac/views/scripts/panier/domain.phtml index 30c7b708e58..01c1df91794 100644 --- a/application/modules/opac/views/scripts/panier/domain.phtml +++ b/application/modules/opac/views/scripts/panier/domain.phtml @@ -21,14 +21,13 @@ $panier_pro = $this->tagAnchor($this->url(['controller' => 'panier', echo $this->tag('div', $mes_paniers . $panier_pro); -echo $this->panier_Table($this->paniers, $this->panier_courant, [$this->_('Propriétaire')], ['UserNomComplet']); +echo $this->panier_TableOthers($this->paniers, $this->panier_courant); if($this->panier_courant) { echo $this->tag('a', '', ['name' => 'panier_contenu']) . - $this->listeNotices_TableauPanier($this->panier_courant); + $this->listeNotices_TableauPanier($this->panier_courant); } echo $this->abonne_RetourFiche(); $this->closeBoite(); -?> diff --git a/application/modules/opac/views/scripts/panier/pro.phtml b/application/modules/opac/views/scripts/panier/pro.phtml index 9061b12bd13..a057efc0443 100644 --- a/application/modules/opac/views/scripts/panier/pro.phtml +++ b/application/modules/opac/views/scripts/panier/pro.phtml @@ -22,9 +22,13 @@ $panier_domain = $this->tagAnchor($this->url(['controller' => 'panier', echo $this->tag('div', $mes_paniers . $panier_domain); -echo $this->panier_Table($this->paniers, null, [$this->_('Propriétaire')], ['UserNomComplet'], 2); +echo $this->panier_TableOthers($this->paniers, $this->panier_courant); + +if($this->panier_courant) { + echo $this->tag('a', '', ['name' => 'panier_contenu']) . + $this->listeNotices_TableauPanier($this->panier_courant); +} echo $this->abonne_RetourFiche(); $this->closeBoite(); -?> diff --git a/library/Class/TableDescription/Carts.php b/library/Class/TableDescription/Carts.php new file mode 100644 index 00000000000..3a99b261b3d --- /dev/null +++ b/library/Class/TableDescription/Carts.php @@ -0,0 +1,176 @@ +<?php +/** + * Copyright (c) 2012-2021, 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_TableDescription_Carts extends Class_TableDescription { + + public function init() { + parent::init(); + + $this + ->addColumn($this->_('Nom'), + ['callback' => [$this, 'renderDomains'], + 'sort_attribute' => 'libelle']) + + ->addColumn($this->_('Date de mise à jour'), + ['options' => ['class' => 'dateFormat-ddmmyyyy sorter-shortDate'], + 'callback' => [$this, 'renderHumanDateMaj']]) + + ->addColumn($this->_('Nombre de documents'), + ['attribute' => 'number_of_notices']) + + ->_columnHook() + + ->addColumn($this->_('Exporter'), + ['callback' => [$this, 'renderExportActions'], + 'sortable' => false]) + + ->addRowAction(['canvas_callback' => [$this, 'editRecords']]) + ->addRowAction(['canvas_callback' => [$this, 'showRecords']]) + ->addRowAction(['canvas_callback' => [$this, 'permalink']]) + ->addRowAction(['canvas_callback' => [$this, 'editCart']]) + ->addRowAction(['canvas_callback' => [$this, 'deleteCart']]); + } + + + protected function _columnHook() { + return $this; + } + + + public function renderDomains($model, $attribute, $canvas) { + $view = $canvas->getView(); + $current_cart = $view->current_cart; + + $libelle = $model->getLibelle(); + + $html = ($current_cart && ($model->getId() == $current_cart->getId())) + ? $view->tag('b', $libelle, ['class' => 'selected']) + : $libelle; + + if ( ! $model->hasCatalogues()) + return $html; + + $catalogue_links = []; + + foreach($model->getCatalogues() as $catalogue) + $catalogue_links [] = + $view->tagAnchor(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'paniers', + 'id_catalogue' => $catalogue->getId()], + $catalogue->getLibelle(), + ['class' => 'not_admin_tool']); + + return $html . $view->tag('div', implode(', ', $catalogue_links)); + } + + + public function renderHumanDateMaj($model, $attribute, $canvas) { + return $canvas->getView()->humanDate($model->getDateMaj(), 'dd/MM/Y'); + } + + + public function renderExportActions($model, $attribute, $canvas) { + $view = $canvas->getView(); + + $html = [$view->tagAnchor(['action' => 'export-unimarc', + 'id_panier' => $model->getId()], + $this->_('UNIMARC'), + ['title' => $this->_('Télécharger le parnier %s au format UNIMARC', $model->getLibelle())]), + + $view->tagAnchor(['action' => 'export-liste', + 'id_panier' => $model->getId()], + $this->_('Liste'), + ['title' => $this->_('Télécharge le parnier %s au format liste', $model->getLibelle())])]; + + return implode(' - ', $html); + } + + + public function editRecords($model, $canvas) { + if ( ! $model->canBeEditedByMe()) + return ''; + + $view = $canvas->getView(); + + return $view->tagAnchor(($view->url(['id_panier' => $model->getId()]) + . '#panier_contenu'), + Class_Admin_Skin::current()->renderActionIconOn('edit', + $view, []), + ['title' => $this->_('Modifier le contenu du panier %s', + $model->getLibelle())]); + } + + + public function showRecords($model, $canvas) { + $view = $canvas->getView(); + + return $view->tagPreview($view->url(['controller' => 'recherche', + 'action' => 'simple', + 'id_panier' => $model->getId(), + 'retour_panier' => $model->getId()]), + $this->_('Prévisualisation du panier "%s" en résultat de recherche dans un nouvel onglet', + $model->getLibelle())); + } + + + public function permalink($model, $canvas) { + $view = $canvas->getView(); + return $view->permalink($view->absoluteUrl(['module' => 'opac', + 'controller' => 'recherche', + 'action' => 'simple', + 'id_panier' => $model->getId()], + null, + true)); + } + + + public function editCart($model, $canvas) { + if ( ! $model->canBeEditedByMe()) + return ''; + + $view = $canvas->getView(); + + return $view->tagAnchor($view->url(['action' => 'edit', + 'id_panier' => $model->getId()]), + Class_Admin_Skin::current()->renderActionIconOn('box_configuration', $view, []), + ['title' => $this->_('Modifier les informations du panier %s', + $model->getLibelle()), + 'data-popup' => 'true']); + } + + + public function deleteCart($model, $canvas) { + if ( ! $model->canBeEditedByMe()) + return ''; + + $view = $canvas->getView(); + + return + $view->tagAnchor($view->url(['action' => 'delete', + 'id_panier' => $model->getId()]), + Class_Admin_Skin::current()->renderActionIconOn('delete', $view, []), + ['title' => $this->_('Supprimer le panier %s', + $model->getLibelle()), + 'onclick' => 'javascript:return confirm(\'' . $this->_('Êtes vous sûr de vouloir supprimer le panier %s?', $model->getLibelle()) . '\')']); + } +} diff --git a/library/Class/TableDescription/CartsOthers.php b/library/Class/TableDescription/CartsOthers.php new file mode 100644 index 00000000000..79dc6ca3855 --- /dev/null +++ b/library/Class/TableDescription/CartsOthers.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright (c) 2012-2021, 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_TableDescription_CartsOthers extends Class_TableDescription_Carts { + + protected function _columnHook() { + return + $this->addColumn($this->_('Propriétaire'), + ['attribute' => 'UserNomComplet']); + } +} diff --git a/library/ZendAfi/View/Helper/Admin/RenderTestMyOpac.php b/library/ZendAfi/View/Helper/Admin/RenderTestMyOpac.php index 08cacdbd065..3b579881635 100644 --- a/library/ZendAfi/View/Helper/Admin/RenderTestMyOpac.php +++ b/library/ZendAfi/View/Helper/Admin/RenderTestMyOpac.php @@ -140,6 +140,12 @@ class ZendAfi_View_Helper_Admin_RenderTestMyOpac extends ZendAfi_View_Helper_Bas 'action' => 'fiche', 'id' => Class_Users::getIdentity()->getId()])); + $collection + ->add((new ZendAfi_View_Helper_Admin_RenderTestMyOpacUrl) + ->setUrl(['module' => 'opac', + 'controller' => 'panier', + 'action' => 'pro'])); + $search = static::getSearchUsersEngine(['search_role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, 'search_valid_subscription' => 1, 'search_review' => 1]); @@ -220,10 +226,12 @@ class ZendAfi_View_Helper_Admin_RenderTestMyOpac extends ZendAfi_View_Helper_Bas 'class' => 'http_status']) . $this->view->tagAnchor($url, $url, - ['title' => $this->_('Lien vers %s', $url)]) + ['target' => '_blank', + 'title' => $this->_('Lien vers %s', $url)]) . $this->view->tagAnchor($url_prod, $url_prod, - ['title' => $this->_('Lien vers %s', $url_prod)])); + ['target' => '_blank', + 'title' => $this->_('Lien vers %s', $url_prod)])); } @@ -255,4 +263,4 @@ class ZendAfi_View_Helper_Admin_RenderTestMyOpacUrl { public function getUrl() { return $this->_url; } -} \ No newline at end of file +} diff --git a/library/ZendAfi/View/Helper/Panier/Table.php b/library/ZendAfi/View/Helper/Panier/Table.php index 7eb4a24533a..c36b059d8c5 100644 --- a/library/ZendAfi/View/Helper/Panier/Table.php +++ b/library/ZendAfi/View/Helper/Panier/Table.php @@ -22,108 +22,9 @@ class ZendAfi_View_Helper_Panier_Table extends ZendAfi_View_Helper_BaseHelper { - public function panier_Table($paniers, $panier_courant, $custom_headers = [], $custom_keys = [], $custom_actions = 5) { - $headers = array_merge([$this->_('Nom'), - $this->_('Date'), - $this->_('Nombre de documents'), - $this->_('Exporter')], - $custom_headers); - - $keys = array_merge(['label', - 'date', - 'number_of_notices', - 'exporter'], - $custom_keys); - - $edit_records = function($model) { - return $this->view->tagAnchor($this->view->url(['action' => 'index', - 'id_panier' => $model->getId()]) . '#panier_contenu', - Class_Admin_Skin::current()->renderActionIconOn('edit', $this->view, []), - ['title' => $this->_('Modifier le contenu du panier %s', $model->getLibelle())]); - }; - $show_records = function($model) { - return $this->view->tagPreview($this->view->url(['controller' => 'recherche', - 'action' => 'simple', - 'id_panier' => $model->getId(), - 'retour_panier' => $model->getId()]), - $this->_('Prévisualisation du panier "%s" en résultat de recherche dans un nouvel onglet', $model->getLibelle())); - }; - $permalink = function($model) { - return $this->view->permalink($this->view->absoluteUrl(['module' => 'opac', - 'controller' => 'recherche', - 'action' => 'simple', - 'id_panier' => $model->getId()], - null, - true)); - }; - - $edit = function($model) { - return $this->view->tagAnchor($this->view->url(['action' => 'edit', - 'id_panier' => $model->getId()]), - Class_Admin_Skin::current()->renderActionIconOn('box_configuration', $this->view, []), - ['title' => $this->_('Modifier les informations du panier %s', $model->getLibelle()), - 'data-popup' => 'true']); - }; - - $delete = function($model) { - return $this->view->tagAnchor($this->view->url(['action' => 'delete', - 'id_panier' => $model->getId()]), - Class_Admin_Skin::current()->renderActionIconOn('delete', $this->view, []), - ['title' => $this->_('Supprimer le panier %s', $model->getLibelle()), - 'onclick' => 'javascript:return confirm(\'' . $this->_('Êtes vous sûr de vouloir supprimer le panier %s?', $model->getLibelle()) . '\')']); - }; - - $actions = array_slice([$show_records, - $permalink, - $edit_records, - $edit, - $delete], 0, $custom_actions); - - $custom_keys = [ - 'label' => function($model) use($panier_courant) { - $links = ''; - if ($model->hasCatalogues()) { - $catalogue_links = []; - $catalogues = $model->getCatalogues(); - foreach($catalogues as $catalogue) - $catalogue_links[] = $this->view->tagAnchor(['module' => 'admin', - 'controller' => 'catalogue', - 'action' => 'paniers', - 'id_catalogue' => $catalogue->getId()], - $catalogue->getLibelle(), - ['class' => 'not_admin_tool']); - - $links = $this->view->tag('div', implode(', ', $catalogue_links)); - } - - return ($panier_courant && ($model->getId() == $panier_courant->getId()) - ? $this->view->tag('b', $model->getLibelle(), ['class' => 'selected']) - : $model->getLibelle()) - . $links; - }, - 'date' => function($model) { - return $this->view->humanDate($model->getDateMaj(), 'dd/MM/Y'); - }, - 'exporter' => function($model) { - return $this->view->tagAnchor(['action' => 'export-unimarc', - 'id_panier' => $model->getId()], - $this->_('UNIMARC'), - ['title' => $this->_('Télécharger le parnier %s au format UNIMARC', $model->getLibelle())]) . - ' - ' . - $this->view->tagAnchor(['action' => 'export-liste', - 'id_panier' => $model->getId()], - $this->_('Liste'), - ['title' => $this->_('Télécharge le parnier %s au format liste', $model->getLibelle())]); - } - ]; - - return $this->view->tagModelTable($paniers, - $headers, - $keys, - $actions, - 'paniers', - null, - $custom_keys); + public function panier_Table($paniers, $panier_courant = null) { + $this->view->current_cart = $panier_courant; + return $this->view->renderTable(new Class_TableDescription_Carts('paniers'), + $paniers); } } -?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Panier/TableOthers.php b/library/ZendAfi/View/Helper/Panier/TableOthers.php new file mode 100644 index 00000000000..751d2ebbd67 --- /dev/null +++ b/library/ZendAfi/View/Helper/Panier/TableOthers.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright (c) 2012-2021, 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_Panier_TableOthers extends ZendAfi_View_Helper_BaseHelper { + + public function panier_TableOthers($paniers, $panier_courant = null) { + $this->view->current_cart = $panier_courant; + return $this->view->renderTable(new Class_TableDescription_CartsOthers('paniers'), + $paniers); + } +} diff --git a/library/ZendAfi/View/Helper/Panier/Viewauteur.php b/library/ZendAfi/View/Helper/Panier/Viewauteur.php index bbb8a8edd50..acd8adcffd2 100644 --- a/library/ZendAfi/View/Helper/Panier/Viewauteur.php +++ b/library/ZendAfi/View/Helper/Panier/Viewauteur.php @@ -44,7 +44,7 @@ class ZendAfi_View_Helper_Panier_Viewauteur extends ZendAfi_View_Helper_BaseHelp $html [] = $this->_tag('div', $panier_domain . $panier_pro); - $html [] = $this->view->panier_Table($paniers, [], [], [], 2); + $html [] = $this->view->panier_Table($paniers); if($this->view->erreur) $html [] = $this->_tag('script', sprintf('alert("%s")', $this->view->erreur)); diff --git a/tests/application/modules/opac/controllers/PanierControllerTest.php b/tests/application/modules/opac/controllers/PanierControllerTest.php index 4ba46a1ee0d..fe19dabace8 100644 --- a/tests/application/modules/opac/controllers/PanierControllerTest.php +++ b/tests/application/modules/opac/controllers/PanierControllerTest.php @@ -1849,10 +1849,108 @@ class PanierControllerDomainActionTest extends PanierControllerTestCase { -class PanierControllerProActionTest extends AbstractControllerTestCase { +/* hotline: #138802 */ +abstract class PanierControllerProAndDomainTestCase + extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $panier_notice_pros = []; + foreach ($this->panierNoticeRaws() as $panier_notice_raw) + $panier_notice_pros [] = $this->fixture(Class_PanierNotice::class, + ['id' => $panier_notice_raw['id'], + 'libelle' => $panier_notice_raw['libelle']]) + ->setDateMaj($panier_notice_raw['date_maj']); + + $this->onLoaderOfModel(Class_PanierNotice::class) + + ->whenCalled('findAllBelongsToAdmin') + ->answers($panier_notice_pros) + + ->whenCalled('findAllWithCatalogue') + ->answers($panier_notice_pros) + + ->whenCalled('findAllIdsWithCatalogue') + ->answers([111, 222, 333]); + } + + + public function panierNoticeRaws() { + return [ + ['id' => 111, + 'libelle' => 'Selection jeunesse', + 'date_maj' => '2021-08-10', + 'human_date' => '10/08/2021'], + ['id' => 222, + 'libelle' => 'Selection adulte', + 'date_maj' => '2021-07-30', + 'human_date' => '30/07/2021'], + ['id' => 333, + 'libelle' => 'Selection enfant', + 'date_maj' => '2021-06-20', + 'human_date' => '20/06/2021'] + ]; + } + + + /** + * @test + * @dataProvider panierNoticeRaws + */ + public function tableShouldContainsExpectedLabels($id, $label, $date, $human_date) { + $this->assertXPath('//table[@id="paniers"]/tbody/tr/td', $label); + } + + + /** + * @test + * @dataProvider panierNoticeRaws + */ + public function tableShouldContainsExpectedHumanDate($id, $label, + $date, $human_date) { + $this->assertXPath('//table[@id="paniers"]/tbody/tr/td', $human_date); + } + + + /** + * @test + * @dataProvider panierNoticeRaws + */ + public function tableShouldContainsExpectedAnchors($id, $label, + $date, $human_date) { + $this->assertXPath(sprintf('//table[@id="paniers"]/tbody/tr/td/a[@href="/recherche/simple/id_panier/%s/retour_panier/%s"]', + $id, + $id)); + } + + + /** @test */ + public function columnDateMiseAjourShouldHaveOrder() { + $this->assertXPathContentContains('//table[@id="paniers"]//thead//th[@class= "dateFormat-ddmmyyyy sorter-shortDate"]', 'Date de mise à jour'); + } +} + + + + +class PanierControllerProScreenTest extends PanierControllerProAndDomainTestCase { + public function setUp() { parent::setUp(); - $this->dispatch('/panier/pro', true); + + $this->dispatch('/panier/pro/id_panier/111'); + } + + + /** + * @test + * @dataProvider panierNoticeRaws + */ + public function tableShouldHaveShowCartAnchor($id, $label, $date, $human_date) { + $this->assertXPath(sprintf('//table[@id="paniers"]/tbody/tr/td/a[@href="/panier/pro/id_panier/%s#panier_contenu"]', $id)); } @@ -1860,6 +1958,61 @@ class PanierControllerProActionTest extends AbstractControllerTestCase { public function tableShouldBeDisplayed() { $this->assertXPathContentContains('//div//h1', 'Les paniers des professionnels'); } + + + /** @test */ + public function cart111ShouldBeSelected() { + $this->assertXPathContentContains('//table[@id="paniers"]//b[@class="selected"]', + 'Selection jeunesse'); + } +} + + + + +class PanierControllerDomainScreenTest extends PanierControllerProAndDomainTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/panier/domain'); + } + + + /** + * @test + * @dataProvider panierNoticeRaws + */ + public function tableShouldHaveShowCartAnchor($id, $label, $date, $human_date) { + $this->assertXPath(sprintf('//table[@id="paniers"]/tbody/tr/td/a[@href="/panier/domain/id_panier/%s#panier_contenu"]', + $id)); + } + + + /** + * @test + * @dataProvider panierNoticeRaws + */ + public function tableShouldHaveCartEditAnchor($id, $label, $date, $human_date) { + $this->assertXPath(sprintf('//table[@id="paniers"]/tbody/tr/td/a[@href="/panier/edit/id_panier/%s"]', + $id)); + } + + + /** + * @test + * @dataProvider panierNoticeRaws + */ + public function tableShouldHaveCartDeleteAnchor($id, $label, $date, $human_date) { + $this->assertXPath(sprintf('//table[@id="paniers"]/tbody/tr/td/a[@href="/panier/delete/id_panier/%s"]', + $id)); + } + + + /** @test */ + public function tableShouldHaveCartOwner() { + $this->assertXPathContentContains('//table[@id="paniers"]/thead/tr/th', + 'Propriétaire'); + } } @@ -1919,4 +2072,4 @@ class PanierControllerViewauteurActionTest extends AbstractControllerTestCase { $this->assertNotXPath('//a[contains(@href, "/panier/delete/id_panier/192")]'); } -} \ No newline at end of file +} -- GitLab