From 82a11b3245c1b5e0296f7715a84a2206357ee8c0 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Thu, 19 Dec 2019 17:05:49 +0100
Subject: [PATCH] FEAT #12635 TIME 0:40 Contacts available departments

---
 rest/index.php                                       | 1 +
 src/app/contact/controllers/ContactController.php    | 2 +-
 test/unitTests/app/contact/ContactControllerTest.php | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/rest/index.php b/rest/index.php
index 5da4c1bb5d3..97e45fbee63 100755
--- a/rest/index.php
+++ b/rest/index.php
@@ -119,6 +119,7 @@ $app->put('/contacts/{id}', \Contact\controllers\ContactController::class . ':up
 $app->delete('/contacts/{id}', \Contact\controllers\ContactController::class . ':delete');
 $app->put('/contacts/{id}/activation', \Contact\controllers\ContactController::class . ':updateActivation');
 $app->get('/formattedContacts/{id}/types/{type}', \Contact\controllers\ContactController::class . ':getLightFormattedContact');
+$app->get('/ban/availableDepartments', \Contact\controllers\ContactController::class . ':getAvailableDepartments');
 
 //ContactsCustomFields
 $app->get('/contactsCustomFields', \Contact\controllers\ContactCustomFieldController::class . ':get');
diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php
index 170bfb81fa5..2ba71aadbf8 100755
--- a/src/app/contact/controllers/ContactController.php
+++ b/src/app/contact/controllers/ContactController.php
@@ -601,7 +601,7 @@ class ContactController
         return substr($args['civility'].' '.$args['fullName'], 0, $args['strMaxLength']);
     }
 
-    public function availableReferential()
+    public function getAvailableDepartments()
     {
         $customId = CoreConfigModel::getCustomId();
 
diff --git a/test/unitTests/app/contact/ContactControllerTest.php b/test/unitTests/app/contact/ContactControllerTest.php
index 4ea961670ba..17ce9a68aa7 100755
--- a/test/unitTests/app/contact/ContactControllerTest.php
+++ b/test/unitTests/app/contact/ContactControllerTest.php
@@ -253,10 +253,10 @@ class ContactControllerTest extends TestCase
         $this->assertSame('Mlle Prénom NOM TROP LOOOOOOOOOOOOONG', $name);
     }
 
-    public function testAvailableReferential()
+    public function testGetAvailableDepartments()
     {
         $contactController = new \Contact\controllers\ContactController();
-        $availableReferential = $contactController->availableReferential();
+        $availableReferential = $contactController->getAvailableDepartments();
         $this->assertInternalType('array', $availableReferential);
         $this->assertNotEmpty($availableReferential);
     }
-- 
GitLab