From 9b509b9b07df447d874837cdd1b1c8715512b7e5 Mon Sep 17 00:00:00 2001
From: Patrick Barroca <pbarroca@afi-sa.fr>
Date: Tue, 3 Apr 2018 16:43:31 +0200
Subject: [PATCH] dev #73311 add redmine login and php version in system report

---
 VERSIONS_WIP/73311                            |  1 +
 library/Class/Systeme/Report.php              |  8 +++++--
 .../ZendAfi/View/Helper/Status/HtmlTest.php   | 16 +++++++++++++-
 .../ZendAfi/View/Helper/Status/JsonTest.php   | 21 ++++++++++++-------
 .../ZendAfi/View/Helper/Status/TestCase.php   |  3 ++-
 5 files changed, 37 insertions(+), 12 deletions(-)
 create mode 100644 VERSIONS_WIP/73311

diff --git a/VERSIONS_WIP/73311 b/VERSIONS_WIP/73311
new file mode 100644
index 00000000000..c6d40a11bb3
--- /dev/null
+++ b/VERSIONS_WIP/73311
@@ -0,0 +1 @@
+ - ticket #73311 : Ajout d'indicateurs dans le rapport système
\ No newline at end of file
diff --git a/library/Class/Systeme/Report.php b/library/Class/Systeme/Report.php
index 376f190e699..b9e0002245d 100644
--- a/library/Class/Systeme/Report.php
+++ b/library/Class/Systeme/Report.php
@@ -79,6 +79,8 @@ class Class_Systeme_Report_Headers extends Class_Systeme_Report_Abstract {
                         $this->_('Base de données'),
                         array_at('dbname',
                                  Zend_Db_Table::getDefaultAdapter()->getConfig()));
+
+    $visitor->visitData('php', $this->_('PHP'), PHP_VERSION);
   }
 }
 
@@ -222,7 +224,8 @@ class Class_Systeme_Report_Libraries extends Class_Systeme_Report_Abstract {
                                  'address' => $this->_('Adresse'),
                                  'postal_code' =>  $this->_('CP'),
                                  'city' => $this->_('Ville'),
-                                 'coordinates' => $this->_('Coordonnées')]);
+                                 'coordinates' => $this->_('Coordonnées'),
+                                 'redmine_login' => $this->_('Compte forge')]);
 
     foreach(Class_Bib::findAll() as $library)
       $this->_reportLibrary($library, $visitor);
@@ -236,7 +239,8 @@ class Class_Systeme_Report_Libraries extends Class_Systeme_Report_Abstract {
                            'postal_code' => $library->getCp(),
                            'city' => $library->getVille(),
                            'coordinates' => ['latitude' => $library->getLatitude(),
-                                             'longitude' => $library->getLongitude()]]);
+                                             'longitude' => $library->getLongitude()],
+                           'redmine_login' => $library->getRedmineLogin()]);
   }
 }
 
diff --git a/tests/library/ZendAfi/View/Helper/Status/HtmlTest.php b/tests/library/ZendAfi/View/Helper/Status/HtmlTest.php
index 7f7e792f8f6..77dd3482f75 100644
--- a/tests/library/ZendAfi/View/Helper/Status/HtmlTest.php
+++ b/tests/library/ZendAfi/View/Helper/Status/HtmlTest.php
@@ -28,7 +28,7 @@ class ZendAfi_View_Helper_Status_HtmlTest extends ZendAfi_View_Helper_Status_Tes
   public function setUp() {
     parent::setUp();
 
-    $disk = Storm_Test_ObjectWrapper::mock()
+    $disk = $this->mock()
       ->whenCalled('diskSpaceInfo')
       ->answers((new Class_Entity)
                 ->setFree('0 o')
@@ -66,6 +66,14 @@ class ZendAfi_View_Helper_Status_HtmlTest extends ZendAfi_View_Helper_Status_Tes
   }
 
 
+  /** @test */
+  public function phpVersionShouldBePresent() {
+    $this->assertXPathContentContains($this->_html,
+                                      '//dl/dd[preceding-sibling::dt[text()="PHP"]]',
+                                      PHP_VERSION);
+  }
+
+
   /** @test */
   public function uniqueIdentifierShouldBe2345abc() {
     $this->assertXPathContentContains($this->_html,
@@ -196,6 +204,12 @@ class ZendAfi_View_Helper_Status_HtmlTest extends ZendAfi_View_Helper_Status_Tes
   }
 
 
+  /** @test */
+  public function libraryAstaingRedmineLoginShouldBePresent() {
+    $this->assertXPathContentContains($this->_html, '//td', '@account@sigb-opac');
+  }
+
+
   /** @test */
   public function variableOnOffBibnumShouldBeDisplayed() {
      $this->assertXPathContentContains($this->_html,
diff --git a/tests/library/ZendAfi/View/Helper/Status/JsonTest.php b/tests/library/ZendAfi/View/Helper/Status/JsonTest.php
index 31b40663fa2..f1ac191cb07 100644
--- a/tests/library/ZendAfi/View/Helper/Status/JsonTest.php
+++ b/tests/library/ZendAfi/View/Helper/Status/JsonTest.php
@@ -57,6 +57,12 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes
   }
 
 
+  /** @test */
+  public function phpVersionShouldBePresent() {
+    $this->assertEquals(PHP_VERSION, $this->_report['headers']['php']);
+  }
+
+
   /** @test */
   public function headersBUIDShouldBeGenerated() {
     $this->assertNotEmpty($this->_report['headers']['buid']);
@@ -369,16 +375,15 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes
   /** @test */
   public function librayAnstaingShouldDisplayAdressAndCoordinates() {
     $this->assertContains(['label' => 'Anstaing / Bibliothèque municipale',
-                           'address' => "Place Jules Guesde",
-                           'postal_code' => "59152",
-                           "city" =>  "Anstaing",
-                           "coordinates" => [
-                                             "latitude"=> "11111",
-                                             "longitude"  => "22222"]
+                           'address' => 'Place Jules Guesde',
+                           'postal_code' => '59152',
+                           'city' =>  'Anstaing',
+                           'coordinates' => [
+                                             'latitude'=> '11111',
+                                             'longitude'  => '22222'],
+                           'redmine_login' => '@account@sigb-opac',
                            ],
                           $this->_report['libraries']);
-
-
   }
 
 
diff --git a/tests/library/ZendAfi/View/Helper/Status/TestCase.php b/tests/library/ZendAfi/View/Helper/Status/TestCase.php
index 1db5574cd8f..00e8ad51d29 100644
--- a/tests/library/ZendAfi/View/Helper/Status/TestCase.php
+++ b/tests/library/ZendAfi/View/Helper/Status/TestCase.php
@@ -142,7 +142,8 @@ abstract class ZendAfi_View_Helper_Status_TestCase extends ViewHelperTestCase {
                                  'adresse' => 'Place Jules Guesde',
                                  'cp' => '59152', 'ville' => 'Anstaing',
                                  'lieu' => $anstaing,
-                                 'visibilite' => 2]);
+                                 'visibilite' => 2,
+                                 'redmine_login' => '@account@sigb-opac']);
 
     Class_AdminVar::newInstanceWithId('KOHA_MULTI_SITES', ['valeur' => '' ]);
     return $this;
-- 
GitLab