From 6e28caf1bb263e601a588819fc4680c209eed286 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Wed, 15 Jun 2022 18:07:33 +0200
Subject: [PATCH] dev #156659 add classes to library details counters

---
 VERSIONS_WIP/156659                                 |  1 +
 .../View/Wrapper/Library/RichContent/Details.php    |  6 ++++--
 tests/scenarios/Templates/TemplatesLibraryTest.php  | 13 ++++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
 create mode 100644 VERSIONS_WIP/156659

diff --git a/VERSIONS_WIP/156659 b/VERSIONS_WIP/156659
new file mode 100644
index 00000000000..1ffd4157575
--- /dev/null
+++ b/VERSIONS_WIP/156659
@@ -0,0 +1 @@
+ - fonctionnalité #156659 : Magasin de thèmes : Ajout des classes "users_count" et "documents_count" sur les indicateurs de comptage dans la description de la fiche bibliothèque.
\ No newline at end of file
diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php
index 801c0089729..36568468e45 100644
--- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php
+++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php
@@ -39,10 +39,12 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Details extends Intona
     return $this->_view->renderLibrary($this->_model, ['fields' => $fields])
 
       . $this->_view->tag('p',
-                          $this->_('Nombre d\'utilisateurs : %d', $number_of_users))
+                          $this->_('Nombre d\'utilisateurs : %d', $number_of_users),
+                          ['class' => 'users_count'])
 
       . $this->_view->tag('p',
-                          $this->_('Nombre de documents : %d', $number_of_documents))
+                          $this->_('Nombre de documents : %d', $number_of_documents),
+                          ['class' => 'documents_count'])
 
       . $this->_renderInformations()
 
diff --git a/tests/scenarios/Templates/TemplatesLibraryTest.php b/tests/scenarios/Templates/TemplatesLibraryTest.php
index b916f299c0b..bae1ea0d104 100644
--- a/tests/scenarios/Templates/TemplatesLibraryTest.php
+++ b/tests/scenarios/Templates/TemplatesLibraryTest.php
@@ -22,7 +22,6 @@
 require_once('TemplatesTest.php');
 
 abstract class TemplatesLibraryTestCase extends AbstractControllerTestCase {
-  protected $_storm_default_to_volatile = true;
 
 
   public function setUp() {
@@ -302,6 +301,18 @@ class TemplatesLibraryReadMoreAsAdminTest extends TemplatesLibraryTestCase {
   public function anchorEditLibraryOpeningsShouldLinkToAdminOuverturesIndexIdSiteOne() {
     $this->assertXPath('//a[contains(@class, "edit_openings")][@href="/admin/ouvertures/index/id_site/1"][not(@data-popup)][@target="_blank"]');
   }
+
+
+  /** @test */
+  public function countUsersShouldBeDisplay() {
+    $this->assertXpathContentContains('//div//p[@class="users_count"]', 'Nombre d\'utilisateurs');
+  }
+
+
+  /** @test */
+  public function countRecordsShouldBeDisplay() {
+    $this->assertXpathContentContains('//div//p[@class="documents_count"]', 'Nombre de documents');
+  }
 }
 
 
-- 
GitLab