From 61d906c16854d8bceeec2b01086f1c912923d664 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Fri, 8 Jun 2018 10:30:15 +0000
Subject: [PATCH] FEAT unit test for availableReferential

---
 .../class/class_contacts_v2_Abstract.php                  | 2 +-
 core/Test/ContactControllerTest.php                       | 8 ++++++++
 src/app/contact/controllers/ContactController.php         | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 core/Test/ContactControllerTest.php

diff --git a/apps/maarch_entreprise/class/class_contacts_v2_Abstract.php b/apps/maarch_entreprise/class/class_contacts_v2_Abstract.php
index 1ae79a909d4..e0c8d5df056 100755
--- a/apps/maarch_entreprise/class/class_contacts_v2_Abstract.php
+++ b/apps/maarch_entreprise/class/class_contacts_v2_Abstract.php
@@ -1662,7 +1662,7 @@ abstract class contacts_v2_Abstract extends Database
             <tr>
                 <?php 
                             $contactController = new \Contact\controllers\ContactController();
-            if (!$numDepList = $contactController->availaibleReferential()) {
+            if (!$numDepList = $contactController->availableReferential()) {
                 $stateRef = 'disabled';
                 $stateRefInfo = _WARNING_REF;
                 $stateRefCss = 'opacity:0.5;';
diff --git a/core/Test/ContactControllerTest.php b/core/Test/ContactControllerTest.php
old mode 100644
new mode 100755
index 3318a377e65..28a82d0985c
--- a/core/Test/ContactControllerTest.php
+++ b/core/Test/ContactControllerTest.php
@@ -131,4 +131,12 @@ class ContactControllerTest extends TestCase
 
         $this->assertSame('Mlle Prénom NOM TROP LOOOOOOOOOOOOONG', $name);
     }
+
+    public function testAvailableReferential()
+    {
+        $contactController = new \Contact\controllers\ContactController();
+        $availableReferential = $contactController->availableReferential();
+        $this->assertInternalType('array', $availableReferential);
+        $this->assertNotEmpty($availableReferential);
+    }
 }
diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php
index 4fc4d1bdc0d..61356dffbfc 100644
--- a/src/app/contact/controllers/ContactController.php
+++ b/src/app/contact/controllers/ContactController.php
@@ -179,7 +179,7 @@ class ContactController
         return $aCivility;
     }
 
-    public function availaibleReferential()
+    public function availableReferential()
     {
         $customId = CoreConfigModel::getCustomId();
 
-- 
GitLab