From 5d544f1a71718b38da1e0b1f7ba698ea064ba98f Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Fri, 15 Jun 2018 10:42:35 +0200
Subject: [PATCH] FEAT #7892 Move test to app root

---
 .gitignore                                    |  2 +-
 phpunit.xml                                   | 64 +++++++++----------
 {core/Test => test}/ActionControllerTest.php  |  0
 .../AutocompleteControllerTest.php            |  0
 {core/Test => test}/BasketControllerTest.php  |  0
 {core/Test => test}/ContactControllerTest.php |  0
 .../ContactGroupControllerTest.php            |  0
 .../ContactTypeControllerTest.php             |  0
 {core/Test => test}/CoreControllerTest.php    |  0
 .../Test => test}/DocserverControllerTest.php |  0
 {core/Test => test}/DoctypeControllerTest.php |  0
 {core/Test => test}/EntityControllerTest.php  |  0
 {core/Test => test}/GroupControllerTest.php   |  0
 {core/Test => test}/HistoryControllerTest.php |  0
 .../ListTemplateControllerTest.php            |  0
 .../NotificationControllerTest.php            |  0
 .../NotificationScheduleControllerTest.php    | 15 ++---
 .../Test => test}/ParameterControllerTest.php |  0
 .../Test => test}/PriorityControllerTest.php  |  0
 {core/Test => test}/ReportControllerTest.php  |  0
 {core/Test => test}/ResControllerTest.php     |  0
 {core/Test => test}/StatusControllerTest.php  |  0
 .../Test => test}/TemplateControllerTest.php  |  0
 {core/Test => test}/UserControllerTest.php    |  0
 .../VersionUpdateControllerTest.php           |  0
 {core/Test => test}/define.php                |  0
 26 files changed, 35 insertions(+), 46 deletions(-)
 rename {core/Test => test}/ActionControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/AutocompleteControllerTest.php (100%)
 rename {core/Test => test}/BasketControllerTest.php (100%)
 rename {core/Test => test}/ContactControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/ContactGroupControllerTest.php (100%)
 rename {core/Test => test}/ContactTypeControllerTest.php (100%)
 rename {core/Test => test}/CoreControllerTest.php (100%)
 rename {core/Test => test}/DocserverControllerTest.php (100%)
 rename {core/Test => test}/DoctypeControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/EntityControllerTest.php (100%)
 rename {core/Test => test}/GroupControllerTest.php (100%)
 rename {core/Test => test}/HistoryControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/ListTemplateControllerTest.php (100%)
 rename {core/Test => test}/NotificationControllerTest.php (100%)
 rename {core/Test => test}/NotificationScheduleControllerTest.php (95%)
 rename {core/Test => test}/ParameterControllerTest.php (100%)
 rename {core/Test => test}/PriorityControllerTest.php (100%)
 rename {core/Test => test}/ReportControllerTest.php (100%)
 rename {core/Test => test}/ResControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/StatusControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/TemplateControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/UserControllerTest.php (100%)
 mode change 100755 => 100644
 rename {core/Test => test}/VersionUpdateControllerTest.php (100%)
 rename {core/Test => test}/define.php (100%)
 mode change 100755 => 100644

diff --git a/.gitignore b/.gitignore
index 74c7d808a2f..ae664ef2e86 100755
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,7 @@ apps/maarch_entreprise/xml/log4php.xml
 .phplint.yml
 *.log
 xdelete.sh
-core/Test/build/
+test/build/
 apps/maarch_entreprise/js/angular/main.bundle.js
 modules/convert/batch/scripts/launch_fulltext_letterbox.sh
 modules/convert/batch/scripts/launch_convert_letterbox.sh
diff --git a/phpunit.xml b/phpunit.xml
index 149eea019db..ed98f20dcc6 100755
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,49 +1,43 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<phpunit colors="true" bootstrap="core/Test/define.php">
+<phpunit colors="true" bootstrap="test/define.php">
     <testsuites>
-        <testsuite name="Maarch Core Test Suite">
-            <!--directory>core/Test</directory-->
-            <file>core/Test/ActionControllerTest.php</file>
-            <file>core/Test/AutocompleteControllerTest.php</file>
-            <file>core/Test/BasketControllerTest.php</file>
-            <file>core/Test/ContactControllerTest.php</file>
-            <file>core/Test/ContactGroupControllerTest.php</file>
-            <file>core/Test/ContactTypeControllerTest.php</file>
-            <file>core/Test/DocserverControllerTest.php</file>
-            <file>core/Test/DoctypeControllerTest.php</file>
-            <file>core/Test/EntityControllerTest.php</file>
-            <file>core/Test/GroupControllerTest.php</file>
-            <file>core/Test/ListTemplateControllerTest.php</file>
-            <file>core/Test/NotificationControllerTest.php</file>
-            <file>core/Test/NotificationScheduleControllerTest.php</file>
-            <file>core/Test/ParameterControllerTest.php</file>
-            <file>core/Test/PriorityControllerTest.php</file>
-            <file>core/Test/ReportControllerTest.php</file>
-            <file>core/Test/ResControllerTest.php</file>
-            <file>core/Test/StatusControllerTest.php</file>
-            <file>core/Test/UserControllerTest.php</file>
-            <file>core/Test/VersionUpdateControllerTest.php</file>
-            <file>core/Test/CoreControllerTest.php</file>
-            <file>core/Test/TemplateControllerTest.php</file>
-            <!--<file>modules/convert/Test/ProcessConvertTest.php</file>-->
-            <!--<file>modules/convert/Test/ProcessFulltextTest.php</file>-->
-            <!--<file>modules/convert/Test/ProcessManageConvertTest.php</file>-->
-            <!--<file>modules/convert/Test/ProcessThumbnailsTest.php</file>-->
+        <testsuite name="Maarch Test Suite">
+            <!--directory>test</directory-->
+            <file>test/ActionControllerTest.php</file>
+            <file>test/AutocompleteControllerTest.php</file>
+            <file>test/BasketControllerTest.php</file>
+            <file>test/ContactControllerTest.php</file>
+            <file>test/ContactGroupControllerTest.php</file>
+            <file>test/ContactTypeControllerTest.php</file>
+            <file>test/DocserverControllerTest.php</file>
+            <file>test/DoctypeControllerTest.php</file>
+            <file>test/EntityControllerTest.php</file>
+            <file>test/GroupControllerTest.php</file>
+            <file>test/ListTemplateControllerTest.php</file>
+            <file>test/NotificationControllerTest.php</file>
+            <file>test/NotificationScheduleControllerTest.php</file>
+            <file>test/ParameterControllerTest.php</file>
+            <file>test/PriorityControllerTest.php</file>
+            <file>test/ReportControllerTest.php</file>
+            <file>test/ResControllerTest.php</file>
+            <file>test/StatusControllerTest.php</file>
+            <file>test/UserControllerTest.php</file>
+            <file>test/VersionUpdateControllerTest.php</file>
+            <file>test/CoreControllerTest.php</file>
+            <file>test/TemplateControllerTest.php</file>
             <!-- The last one should be history -->
-            <file>core/Test/HistoryControllerTest.php</file>
+            <file>test/HistoryControllerTest.php</file>
         </testsuite>
     </testsuites>
     <filter>
       <whitelist>
           <directory suffix="Test.php">core/Test</directory>
           <directory suffix=".php">src</directory>
-          <!--<directory suffix=".php">modules/convert/Controllers</directory>-->
-          <!--<directory suffix=".php">modules/convert/Models</directory>-->
       </whitelist>
     </filter>
     <logging>
-        <log type="coverage-clover" target="core/Test/build/tests-clover.xml"/>
-        <log type="junit"           target="core/Test/build/tests-phpunit.xml" logIncompleteSkipped="false"/>
-        <log type="coverage-html"   target="core/Test/build" lowUpperBound="35" highLowerBound="70"/>
+        <log type="coverage-clover" target="test/build/tests-clover.xml"/>
+        <log type="junit"           target="test/build/tests-phpunit.xml" logIncompleteSkipped="false"/>
+        <log type="coverage-html"   target="test/build" lowUpperBound="35" highLowerBound="70"/>
     </logging>
 </phpunit>
diff --git a/core/Test/ActionControllerTest.php b/test/ActionControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/ActionControllerTest.php
rename to test/ActionControllerTest.php
diff --git a/core/Test/AutocompleteControllerTest.php b/test/AutocompleteControllerTest.php
similarity index 100%
rename from core/Test/AutocompleteControllerTest.php
rename to test/AutocompleteControllerTest.php
diff --git a/core/Test/BasketControllerTest.php b/test/BasketControllerTest.php
similarity index 100%
rename from core/Test/BasketControllerTest.php
rename to test/BasketControllerTest.php
diff --git a/core/Test/ContactControllerTest.php b/test/ContactControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/ContactControllerTest.php
rename to test/ContactControllerTest.php
diff --git a/core/Test/ContactGroupControllerTest.php b/test/ContactGroupControllerTest.php
similarity index 100%
rename from core/Test/ContactGroupControllerTest.php
rename to test/ContactGroupControllerTest.php
diff --git a/core/Test/ContactTypeControllerTest.php b/test/ContactTypeControllerTest.php
similarity index 100%
rename from core/Test/ContactTypeControllerTest.php
rename to test/ContactTypeControllerTest.php
diff --git a/core/Test/CoreControllerTest.php b/test/CoreControllerTest.php
similarity index 100%
rename from core/Test/CoreControllerTest.php
rename to test/CoreControllerTest.php
diff --git a/core/Test/DocserverControllerTest.php b/test/DocserverControllerTest.php
similarity index 100%
rename from core/Test/DocserverControllerTest.php
rename to test/DocserverControllerTest.php
diff --git a/core/Test/DoctypeControllerTest.php b/test/DoctypeControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/DoctypeControllerTest.php
rename to test/DoctypeControllerTest.php
diff --git a/core/Test/EntityControllerTest.php b/test/EntityControllerTest.php
similarity index 100%
rename from core/Test/EntityControllerTest.php
rename to test/EntityControllerTest.php
diff --git a/core/Test/GroupControllerTest.php b/test/GroupControllerTest.php
similarity index 100%
rename from core/Test/GroupControllerTest.php
rename to test/GroupControllerTest.php
diff --git a/core/Test/HistoryControllerTest.php b/test/HistoryControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/HistoryControllerTest.php
rename to test/HistoryControllerTest.php
diff --git a/core/Test/ListTemplateControllerTest.php b/test/ListTemplateControllerTest.php
similarity index 100%
rename from core/Test/ListTemplateControllerTest.php
rename to test/ListTemplateControllerTest.php
diff --git a/core/Test/NotificationControllerTest.php b/test/NotificationControllerTest.php
similarity index 100%
rename from core/Test/NotificationControllerTest.php
rename to test/NotificationControllerTest.php
diff --git a/core/Test/NotificationScheduleControllerTest.php b/test/NotificationScheduleControllerTest.php
similarity index 95%
rename from core/Test/NotificationScheduleControllerTest.php
rename to test/NotificationScheduleControllerTest.php
index 99d312efa26..a3f770f46b5 100644
--- a/core/Test/NotificationScheduleControllerTest.php
+++ b/test/NotificationScheduleControllerTest.php
@@ -63,10 +63,9 @@ class NotificationScheduleControllerTest extends TestCase
         $responseBody = json_decode((string) $response->getBody());
 
         // CREATE FAIL
-        $aArgs = [];
         $aArgs = $responseBody->crontab;
 
-        $corePath = dirname(__FILE__, 3).'/';
+        $corePath = dirname(__FILE__, 2).'/';
         $newCrontab = [
             'm' => 12,
             'h' => 23,
@@ -88,10 +87,9 @@ class NotificationScheduleControllerTest extends TestCase
         $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'POST']);
         $request = \Slim\Http\Request::createFromEnvironment($environment);
 
-        $aArgs = [];
         $aArgs = $responseBody->crontab;
 
-        $corePath = dirname(__FILE__, 3).'/';
+        $corePath = dirname(__FILE__, 2).'/';
         $newCrontab = [
             'm' => 12,
             'h' => 23,
@@ -138,10 +136,9 @@ class NotificationScheduleControllerTest extends TestCase
         $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'POST']);
         $request = \Slim\Http\Request::createFromEnvironment($environment);
 
-        $aArgs = [];
         $aArgs = $responseBody->crontab;
 
-        $corePath = dirname(__FILE__, 3).'/';
+        $corePath = dirname(__FILE__, 2).'/';
 
         $aArgs[count($aArgs) - 1] = [
             'm' => 35,
@@ -181,11 +178,10 @@ class NotificationScheduleControllerTest extends TestCase
         $response = $NotificationScheduleController->get($request, new \Slim\Http\Response());
         $responseBody = json_decode((string) $response->getBody());
 
-        $aArgs = [];
         $aArgs = $responseBody->crontab;
 
         foreach ($aArgs as $id => $value) {
-            if ($value->cmd == dirname(__FILE__, 3).'/'.'modules/notifications/batch/scripts/notification_testtu.sh') {
+            if ($value->cmd == dirname(__FILE__, 2).'/'.'modules/notifications/batch/scripts/notification_testtu.sh') {
                 $aArgs[$id]->state = 'hidden';
             }
         }
@@ -200,11 +196,10 @@ class NotificationScheduleControllerTest extends TestCase
         $this->assertSame('Problem with crontab', $responseBodyFail->errors);
 
         // DELETE
-        $aArgs = [];
         $aArgs = $responseBody->crontab;
 
         foreach ($aArgs as $id => $value) {
-            if ($value->cmd == dirname(__FILE__, 3).'/'.'modules/notifications/batch/scripts/notification_testtu.sh') {
+            if ($value->cmd == dirname(__FILE__, 2).'/'.'modules/notifications/batch/scripts/notification_testtu.sh') {
                 $aArgs[$id]->state = 'deleted';
             }
         }
diff --git a/core/Test/ParameterControllerTest.php b/test/ParameterControllerTest.php
similarity index 100%
rename from core/Test/ParameterControllerTest.php
rename to test/ParameterControllerTest.php
diff --git a/core/Test/PriorityControllerTest.php b/test/PriorityControllerTest.php
similarity index 100%
rename from core/Test/PriorityControllerTest.php
rename to test/PriorityControllerTest.php
diff --git a/core/Test/ReportControllerTest.php b/test/ReportControllerTest.php
similarity index 100%
rename from core/Test/ReportControllerTest.php
rename to test/ReportControllerTest.php
diff --git a/core/Test/ResControllerTest.php b/test/ResControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/ResControllerTest.php
rename to test/ResControllerTest.php
diff --git a/core/Test/StatusControllerTest.php b/test/StatusControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/StatusControllerTest.php
rename to test/StatusControllerTest.php
diff --git a/core/Test/TemplateControllerTest.php b/test/TemplateControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/TemplateControllerTest.php
rename to test/TemplateControllerTest.php
diff --git a/core/Test/UserControllerTest.php b/test/UserControllerTest.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/UserControllerTest.php
rename to test/UserControllerTest.php
diff --git a/core/Test/VersionUpdateControllerTest.php b/test/VersionUpdateControllerTest.php
similarity index 100%
rename from core/Test/VersionUpdateControllerTest.php
rename to test/VersionUpdateControllerTest.php
diff --git a/core/Test/define.php b/test/define.php
old mode 100755
new mode 100644
similarity index 100%
rename from core/Test/define.php
rename to test/define.php
-- 
GitLab