Преглед на файлове

Merge branch 'feature/V8-4258-test-de-route-sur-ap2i' into develop

Olivier Massot преди 2 години
родител
ревизия
336274574a
променени са 100 файла, в които са добавени 837 реда и са изтрити 227 реда
  1. 1 1
      .env.docker
  2. 0 57
      .env.preprod
  3. 48 0
      .env.staging
  4. 2 1
      .gitlab-ci.yml
  5. 8 2
      composer.json
  6. 8 6
      config/bundles.php
  7. 2 0
      config/packages/doctrine.yaml
  8. 1 3
      config/packages/framework.yaml
  9. 0 14
      config/packages/monolog.yaml
  10. 1 1
      config/packages/nelmio_alice.yaml
  11. 4 0
      config/packages/staging/framework.yaml
  12. 12 0
      config/packages/staging/monolog.yaml
  13. 8 0
      config/packages/staging/security.yaml
  14. 2 0
      config/packages/staging/twig.yaml
  15. 3 0
      config/packages/staging/validator.yaml
  16. 6 0
      config/packages/staging/web_profiler.yaml
  17. 2 2
      config/packages/test/framework.yaml
  18. 7 0
      config/packages/zenstruck_foundry.yaml
  19. 3 0
      config/services.yaml
  20. 14 4
      phpunit.xml.dist
  21. 7 7
      sql/schema-extensions/002-view_federation_structures.sql
  22. 1 1
      src/Entity/Billing/AbstractBillingIntangible.php
  23. 3 3
      src/Entity/Billing/EducationalProjectIntangible.php
  24. 68 1
      src/Entity/Booking/AbstractBooking.php
  25. 248 0
      src/Entity/Core/AbstractInformation.php
  26. 0 1
      src/Entity/Core/File.php
  27. 1 16
      src/Entity/Core/Notification.php
  28. 6 5
      src/Entity/Core/NotificationUser.php
  29. 17 2
      src/Entity/Core/Tips.php
  30. 2 1
      src/Entity/Organization/Organization.php
  31. 2 2
      src/Entity/Organization/Parameters.php
  32. 7 15
      src/Entity/Place/Place.php
  33. 2 2
      src/Entity/Public/FederationStructure.php
  34. 16 0
      src/Enum/Booking/VisibilityEnum.php
  35. 1 0
      src/Service/Security/InternalRequestsService.php
  36. 65 0
      tests/Application/OtWebTestCase.php
  37. 26 0
      tests/Application/Public/PublicEventsTest.php
  38. 27 0
      tests/Application/Public/PublicStructuresTest.php
  39. 111 0
      tests/Fixture/OrganizationFixtures.php
  40. 16 0
      tests/Fixture/readme.md
  41. 3 3
      tests/Unit/Filter/DoctrineFilter/DateTimeFilterTest.php
  42. 1 1
      tests/Unit/Service/Access/AccessProfileCreatorTest.php
  43. 1 1
      tests/Unit/Service/Access/AdminAccessUtilsTest.php
  44. 1 1
      tests/Unit/Service/Access/OptionalsRoles/CriteriaNotationOptionalRoleTest.php
  45. 1 1
      tests/Unit/Service/Access/UtilsTest.php
  46. 2 3
      tests/Unit/Service/ApiLegacy/ApiLegacyRequestServiceTest.php
  47. 2 2
      tests/Unit/Service/Constraint/AbstractTimeConstraintsUtilsTest.php
  48. 1 1
      tests/Unit/Service/Constraint/ActivityYearConstraintTest.php
  49. 2 2
      tests/Unit/Service/Constraint/DateTimeConstraintTest.php
  50. 1 1
      tests/Unit/Service/Core/AddressPostalUtilsTest.php
  51. 1 1
      tests/Unit/Service/Core/ContactPointUtilsTest.php
  52. 1 1
      tests/Unit/Service/Cotisation/CotisationCreatorTest.php
  53. 2 2
      tests/Unit/Service/Cotisation/UtilsTest.php
  54. 1 1
      tests/Unit/Service/Cron/BaseCronJobTest.php
  55. 1 1
      tests/Unit/Service/Cron/Job/CleanTempFilesTest.php
  56. 1 1
      tests/Unit/Service/Cron/Job/DolibarrSyncTest.php
  57. 4 4
      tests/Unit/Service/Cron/UI/ConsoleUITest.php
  58. 1 1
      tests/Unit/Service/Dolibarr/DolibarrAccountCreatorTest.php
  59. 1 1
      tests/Unit/Service/Dolibarr/DolibarrApiServiceTest.php
  60. 2 2
      tests/Unit/Service/Dolibarr/DolibarrSyncServiceTest.php
  61. 1 1
      tests/Unit/Service/Education/EducationNotationUtilsTest.php
  62. 1 1
      tests/Unit/Service/Elasticsearch/EducationNotationUpdaterTest.php
  63. 1 1
      tests/Unit/Service/Export/BaseExporterTest.php
  64. 1 1
      tests/Unit/Service/Export/Encoder/PdfEncoderTest.php
  65. 3 3
      tests/Unit/Service/Export/LicenceCmfExporterTest.php
  66. 1 1
      tests/Unit/Service/Export/Model/LicenceCmfCollectionTest.php
  67. 1 1
      tests/Unit/Service/Export/Model/LicenceCmfTest.php
  68. 1 1
      tests/Unit/Service/File/FileManagerTest.php
  69. 1 1
      tests/Unit/Service/File/Storage/ApiLegacyStorageTest.php
  70. 1 1
      tests/Unit/Service/File/Storage/LocalStorageTest.php
  71. 2 2
      tests/Unit/Service/Mailer/Builder/AbstractBuilderTest.php
  72. 2 2
      tests/Unit/Service/Mailer/Builder/OnSubdomainChangeMailBuilderTest.php
  73. 2 2
      tests/Unit/Service/Mailer/MailerTest.php
  74. 1 1
      tests/Unit/Service/MercureHubTest.php
  75. 1 1
      tests/Unit/Service/Mobyt/MobytServiceTest.php
  76. 2 2
      tests/Unit/Service/Mobyt/MobytUserStatusCreatorTest.php
  77. 2 2
      tests/Unit/Service/Network/TreeTest.php
  78. 2 2
      tests/Unit/Service/Network/UtilsTest.php
  79. 1 1
      tests/Unit/Service/NotifierTest.php
  80. 1 1
      tests/Unit/Service/OnChange/OnChangeContextTest.php
  81. 1 1
      tests/Unit/Service/OnChange/OnChangeDefaultTest.php
  82. 1 1
      tests/Unit/Service/OnChange/Organization/OnOrganizationChangeTest.php
  83. 1 1
      tests/Unit/Service/OnChange/Organization/OnParametersChangeTest.php
  84. 1 1
      tests/Unit/Service/Organization/OrganizationProfileCreatorTest.php
  85. 1 1
      tests/Unit/Service/Organization/UtilsTest.php
  86. 2 2
      tests/Unit/Service/Rest/ApiRequestServiceTest.php
  87. 1 1
      tests/Unit/Service/Rest/Operation/BaseRestOperationTest.php
  88. 1 1
      tests/Unit/Service/Rest/Operation/CreateOperationTest.php
  89. 1 1
      tests/Unit/Service/Rest/Operation/DeleteOperationTest.php
  90. 1 1
      tests/Unit/Service/Rest/Operation/UpdateOperationTest.php
  91. 1 1
      tests/Unit/Service/Security/InternalRequestsServiceTest.php
  92. 1 1
      tests/Unit/Service/Security/ModuleTest.php
  93. 1 1
      tests/Unit/Service/Security/SwitchUserTest.php
  94. 1 1
      tests/Unit/Service/ServiceIterator/CronjobIteratorTest.php
  95. 1 1
      tests/Unit/Service/ServiceIterator/CurrentAccessExtensionIteratorTest.php
  96. 1 1
      tests/Unit/Service/ServiceIterator/EncoderIteratorTest.php
  97. 1 1
      tests/Unit/Service/ServiceIterator/ExporterIteratorTest.php
  98. 1 1
      tests/Unit/Service/ServiceIterator/Mailer/BuilderIteratorTest.php
  99. 1 1
      tests/Unit/Service/ServiceIterator/OptionalsRolesIteratorTest.php
  100. 1 1
      tests/Unit/Service/Twig/AssetsExtensionTest.php

+ 1 - 1
.env.docker

@@ -12,7 +12,7 @@ CORS_ALLOW_ORIGIN=^https?:\/\/(localhost|127\.0\.0\.1|(local.(admin|app|app\-v3|
 
 ###> api v1 ###
 API_LEG_BASE_URL=http://nginx/
-###< files management ###
+###< api v1 ###
 
 ###> BlackFire configuration ###
 BLACKFIRE_CLIENT_ID=988fcba8-552d-48df-a9c2-035c76535b69

+ 0 - 57
.env.preprod

@@ -1,57 +0,0 @@
-###> symfony/framework-bundle ###
-APP_DEBUG=1
-###< symfony/framework-bundle ###
-
-###> doctrine/doctrine-bundle ###
-DATABASE_URL=mysql://root:mysql2iopenservice369566@preprod:3306/opentalent?serverVersion=5.7
-###< doctrine/doctrine-bundle ###
-
-###> nelmio/cors-bundle ###
-CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)$
-###< nelmio/cors-bundle ###
-
-###> api v1 ###
-API_LEG_BASE_URL=https://api.preprod.opentalent.fr/api
-###< files management ###
-
-###> typo3 client ###
-TYPO3_BASE_URI=http://preprod.opentalent.fr/ohcluses
-###< typo3 client ###
-
-###> BlackFire configuration ###
-BLACKFIRE_CLIENT_ID=988fcba8-552d-48df-a9c2-035c76535b69
-BLACKFIRE_CLIENT_TOKEN=8cfbeb263d044da9678dc2612531504da3790c308da7448e35724a5da91c136f
-BLACKFIRE_SERVER_ID=1171e53b-459b-41da-a292-80ff68cee8c2
-BLACKFIRE_SERVER_TOKEN=dbd1cfbea015fe83cccfc189a36ca3c16f3a1b43b94f50032a15e41e53548e8b
-###< BlackFire configuration ###
-
-###> AdminAssos configuration ###
-DATABASE_ADMINASSOS_URL=mysql://root:mysql2iopenservice369566@preprod:3306/adminassos?serverVersion=5.7
-###< AdminAssos configuration ###
-
-###> Audit configuration ###
-DATABASE_AUDIT_URL=mysql://root:mysql2iopenservice369566@preprod:3306/audit?serverVersion=5.7
-###< Audit configuration ###
-
-###> symfony/mercure-bundle ###
-# See https://symfony.com/doc/current/mercure.html#configuration
-# The URL of the Mercure hub, used by the app to publish updates (can be a local URL)
-MERCURE_URL=https://mercure.preprod.opentalent.fr/.well-known/mercure
-# The public URL of the Mercure hub, used by the browser to connect
-MERCURE_PUBLIC_URL=https://mercure.preprod.opentalent.fr/.well-known/mercure
-# The secret used to sign the JWTs
-MERCURE_JWT_SECRET=NQEupdREijrfYvCmF2mnvZQFL9zLKDH9RCYter6tUWzjemPqzicffhc2fSf0yEmM
-###< symfony/mercure-bundle ###
-
-###> bindfile populate buffer file
-BIND_FILE_BUFFER_FILE=var/subdomain.txt
-###< bindfile populate buffer file
-
-###> knplabs/knp-snappy-bundle ###
-WKHTMLTOPDF_PATH=/usr/bin/wkhtmltopdf
-WKHTMLTOIMAGE_PATH=/usr/bin/wkhtmltoimage
-###< knplabs/knp-snappy-bundle ###
-
-###> filename log ###
-LOG_FILE_NAME=preprod
-###< filename log ###

+ 48 - 0
.env.staging

@@ -0,0 +1,48 @@
+# Fichier d'env utilisé pour les tests fonctionnels et applicatifs
+APP_DEBUG=1
+
+###> doctrine/doctrine-bundle ###
+DATABASE_URL=mysql://root:mysql660@db:3306/opentalent_test?serverVersion=5.7
+###< doctrine/doctrine-bundle ###
+
+###> nelmio/cors-bundle ###
+CORS_ALLOW_ORIGIN=^$
+###< nelmio/cors-bundle ###
+
+####> api v1 ###
+API_LEG_BASE_URL=https://none
+####< api v1 ###
+
+###> elasticsearch ###
+ELASTICSEARCH_HOST=es
+ELASTICSEARCH_PORT=9200
+###< elasticsearch ###
+
+###> BlackFire configuration ###
+BLACKFIRE_CLIENT_ID=988fcba8-552d-48df-a9c2-035c76535b69
+BLACKFIRE_CLIENT_TOKEN=8cfbeb263d044da9678dc2612531504da3790c308da7448e35724a5da91c136f
+BLACKFIRE_SERVER_ID=1171e53b-459b-41da-a292-80ff68cee8c2
+BLACKFIRE_SERVER_TOKEN=dbd1cfbea015fe83cccfc189a36ca3c16f3a1b43b94f50032a15e41e53548e8b
+###< BlackFire configuration ###
+
+###> AdminAssos configuration ###
+DATABASE_ADMINASSOS_URL=mysql://root:mysql660@db:3306/adminassos_test?serverVersion=5.7
+###< AdminAssos configuration ###
+
+###> Audit configuration ###
+DATABASE_AUDIT_URL=mysql://root:mysql660@db:3306/audit_test?serverVersion=5.7
+###< Audit configuration ###
+
+###> typo3 client ###
+TYPO3_BASE_URI=https://none
+###< typo3 client ###
+
+###> symfony/mercure-bundle ###
+# See https://symfony.com/doc/current/mercure.html#configuration
+# The URL of the Mercure hub, used by the app to publish updates (can be a local URL)
+MERCURE_URL=https://none
+# The public URL of the Mercure hub, used by the browser to connect
+MERCURE_PUBLIC_URL=https://none
+# The secret used to sign the JWTs
+MERCURE_JWT_SECRET=gEwnJpcR8k0xE2sfBpEJzzuP2b2TXhZnzImIqCUk3j4RStBZa2pQjbEMsnGE4iGM
+###< symfony/mercure-bundle ###

+ 2 - 1
.gitlab-ci.yml

@@ -26,7 +26,8 @@ unit:
   stage: test
 
   script:
-    - php bin/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction
+    - php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --testsuite=unit
+    #- php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --no-coverage --testsuite=application
 
   artifacts:
     paths:

+ 8 - 2
composer.json

@@ -62,14 +62,16 @@
         "twig/cssinliner-extra": "^3.4",
         "twig/extra-bundle": "^3.4",
         "twig/inky-extra": "^3.4",
-        "vincent/foselastica": "1.3",
+        "vincent/foselastica": "1.3.1",
         "webonyx/graphql-php": "^14.3",
         "xantios/mimey": "*"
     },
     "require-dev": {
         "cyclonedx/cyclonedx-php-composer": "^3.4",
         "dg/bypass-finals": "^1.4",
+        "doctrine/doctrine-fixtures-bundle": "^3.4",
         "hautelook/alice-bundle": "^2.11",
+        "justinrainbow/json-schema": "^5.2",
         "phpstan/extension-installer": "^1.2",
         "phpstan/phpstan": "^1.9",
         "phpstan/phpstan-doctrine": "^1.3",
@@ -77,12 +79,15 @@
         "phpstan/phpstan-symfony": "^1.2",
         "phpunit/phpunit": "^9.6",
         "rector/rector": "^0.15.13",
+        "symfony/browser-kit": "6.2.*",
+        "symfony/css-selector": "6.2.*",
         "symfony/debug-bundle": "6.2.*",
         "symfony/maker-bundle": "^1.21",
         "symfony/phpunit-bridge": "^6.2",
         "symfony/stopwatch": "6.2.*",
         "symfony/web-profiler-bundle": "6.2.*",
-        "timeweb/phpstan-enum": "^3.1"
+        "timeweb/phpstan-enum": "^3.1",
+        "zenstruck/foundry": "^1.31"
     },
     "config": {
         "optimize-autoloader": true,
@@ -103,6 +108,7 @@
     },
     "autoload-dev": {
         "psr-4": {
+            "DataFixtures\\": "tests/Fixture",
             "App\\Tests\\": "tests/"
         }
     },

+ 8 - 6
config/bundles.php

@@ -3,7 +3,7 @@
 return [
     Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
     Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
-    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['docker' => true, 'test' => true],
+    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'docker' => true, 'staging' => true],
     Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
     Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
     Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
@@ -12,15 +12,17 @@ return [
     Jb\Bundle\PhumborBundle\JbPhumborBundle::class => ['all' => true],
     Misd\PhoneNumberBundle\MisdPhoneNumberBundle::class => ['all' => true],
     Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
-    Symfony\Bundle\MakerBundle\MakerBundle::class => ['docker' => true],
+    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true, 'docker' => true, 'staging' => true],
     FOS\ElasticaBundle\FOSElasticaBundle::class => ['all' => true],
     Knp\Bundle\SnappyBundle\KnpSnappyBundle::class => ['all' => true],
     Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],
     Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
-    Symfony\Bundle\DebugBundle\DebugBundle::class => ['docker' => true],
+    Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'docker' => true, 'staging' => true],
     Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
     Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
-    Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true],
-    Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true],
-    Hautelook\AliceBundle\HautelookAliceBundle::class => ['dev' => true, 'test' => true],
+    Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'staging' => true],
+    Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['staging' => true],
+    Hautelook\AliceBundle\HautelookAliceBundle::class => ['staging' => true],
+    Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['staging' => true],
+    Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['staging' => true],
 ];

+ 2 - 0
config/packages/doctrine.yaml

@@ -9,6 +9,7 @@ doctrine:
                 # IMPORTANT: You MUST configure your server version,
                 # either here or in the DATABASE_URL env var (see .env file)
                 server_version: '5.7'
+                schema_filter: ~^(?!view_)~
 
             audit:
                 url: '%env(resolve:DATABASE_AUDIT_URL)%'
@@ -23,6 +24,7 @@ doctrine:
         types:
             uuid: Ramsey\Uuid\Doctrine\UuidType
 
+
     orm:
         default_entity_manager: default
         auto_generate_proxy_classes: true

+ 1 - 3
config/packages/framework.yaml

@@ -41,8 +41,6 @@ framework:
             apiLegacyClient:
                 base_uri: '%env(API_LEG_BASE_URL)%'
 
-when@test:
+when@staging:
     framework:
         test: true
-        session:
-            storage_factory_id: session.storage.factory.mock_file

+ 0 - 14
config/packages/monolog.yaml

@@ -23,20 +23,6 @@ when@dev:
                 process_psr_3_messages: false
                 channels: ["!event", "!doctrine", "!console"]
 
-when@test:
-    monolog:
-        handlers:
-            main:
-                type: fingers_crossed
-                action_level: error
-                handler: nested
-                excluded_http_codes: [404, 405]
-                channels: ["!event"]
-            nested:
-                type: stream
-                path: "%kernel.logs_dir%/%kernel.environment%.log"
-                level: debug
-
 when@prod:
     monolog:
         handlers:

+ 1 - 1
config/packages/nelmio_alice.yaml

@@ -9,4 +9,4 @@ when@dev: &dev
             - 'md5'
             - 'sha1'
 
-when@test: *dev
+when@staging: *dev

+ 4 - 0
config/packages/staging/framework.yaml

@@ -0,0 +1,4 @@
+framework:
+    test: true
+#    session:
+#        storage_factory_id: session.storage.mock_file

+ 12 - 0
config/packages/staging/monolog.yaml

@@ -0,0 +1,12 @@
+monolog:
+    handlers:
+        main:
+            type: fingers_crossed
+            action_level: error
+            handler: nested
+            excluded_http_codes: [404, 405]
+            channels: ["!event"]
+        nested:
+            type: stream
+            path: "%kernel.logs_dir%/%kernel.environment%.log"
+            level: debug

+ 8 - 0
config/packages/staging/security.yaml

@@ -0,0 +1,8 @@
+# override in api/config/packages/test/security.yaml for test env
+# improve the test suite speed
+security:
+  password_hashers:
+    App\Entity\Person\Person:
+      algorithm: md5
+      encode_as_base64: false
+      iterations: 0

+ 2 - 0
config/packages/staging/twig.yaml

@@ -0,0 +1,2 @@
+twig:
+    strict_variables: true

+ 3 - 0
config/packages/staging/validator.yaml

@@ -0,0 +1,3 @@
+framework:
+    validation:
+        not_compromised_password: false

+ 6 - 0
config/packages/staging/web_profiler.yaml

@@ -0,0 +1,6 @@
+web_profiler:
+    toolbar: false
+    intercept_redirects: false
+
+framework:
+    profiler: { collect: false }

+ 2 - 2
config/packages/test/framework.yaml

@@ -1,4 +1,4 @@
 framework:
     test: true
-    session:
-        storage_factory_id: session.storage.mock_file
+#    session:
+#        storage_factory_id: session.storage.mock_file

+ 7 - 0
config/packages/zenstruck_foundry.yaml

@@ -0,0 +1,7 @@
+when@dev: &dev
+    # See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
+    zenstruck_foundry:
+        # Whether to auto-refresh proxies by default (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#auto-refresh)
+        auto_refresh_proxies: true
+
+when@staging: *dev

+ 3 - 0
config/services.yaml

@@ -148,3 +148,6 @@ services:
     Symfony\Component\DependencyInjection\ContainerInterface: '@service_container'
     #########################################
 
+    # To use the test fixtures
+    App\Tests\Fixture\:
+        resource: '%kernel.project_dir%/tests/Fixture/*'

+ 14 - 4
phpunit.xml.dist

@@ -1,6 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="tests/bootstrap.php">
+<phpunit
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
+        backupGlobals="false"
+        colors="true"
+        bootstrap="tests/bootstrap.php"
+        defaultTestSuite="unit"
+>
   <coverage includeUncoveredFiles="true">
     <include>
       <directory suffix=".php">src</directory>
@@ -12,15 +19,18 @@
   </coverage>
   <php>
     <ini name="error_reporting" value="-1"/>
-    <server name="APP_ENV" value="test" force="true"/>
+    <server name="APP_ENV" value="staging" force="true"/>
     <server name="SHELL_VERBOSITY" value="-1"/>
     <server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
     <server name="SYMFONY_PHPUNIT_VERSION" value="9.4"/>
     <server name="KERNEL_CLASS" value="App\Kernel" />
   </php>
   <testsuites>
-    <testsuite name="Project Test Suite">
-      <directory>tests</directory>
+    <testsuite name="unit">
+      <directory>tests/Unit</directory>
+    </testsuite>
+    <testsuite name="application">
+      <directory>tests/Application</directory>
     </testsuite>
   </testsuites>
   <listeners>

+ 7 - 7
sql/schema-extensions/002-view_federation_structures.sql

@@ -12,13 +12,13 @@ AS
                AS practices,
            oar.articles, n1.parent_id as parentId, net1.name as parentName,
            CONCAT_WS(',', n1.parent_id, n2.parent_id, n3.parent_id, n4.parent_id, n5.parent_id) as parents
-    FROM opentalent.Organization o
-             INNER JOIN opentalent.Parameters p on o.parameters_id = p.id
-             LEFT JOIN opentalent.OrganizationAddressPostal oa on oa.organization_id = o.id
-             LEFT JOIN opentalent.AddressPostal a on oa.addressPostal_id = a.id
-             LEFT JOIN opentalent.Country c ON (c.id = a.addressCountry_id)
-             LEFT JOIN opentalent.organization_contactpoint ocp ON ocp.organization_id = o.id
-             INNER JOIN (SELECT * FROM opentalent.ContactPoint WHERE `contactType`='PRINCIPAL') cp ON cp.id = ocp.contactPoint_id
+    FROM Organization o
+             INNER JOIN Parameters p on o.parameters_id = p.id
+             LEFT JOIN OrganizationAddressPostal oa on oa.organization_id = o.id
+             LEFT JOIN AddressPostal a on oa.addressPostal_id = a.id
+             LEFT JOIN Country c ON (c.id = a.addressCountry_id)
+             LEFT JOIN organization_contactpoint ocp ON ocp.organization_id = o.id
+             INNER JOIN (SELECT * FROM ContactPoint WHERE `contactType`='PRINCIPAL') cp ON cp.id = ocp.contactPoint_id
              LEFT JOIN (
                 SELECT oar_.organization_id, CONCAT('[', GROUP_CONCAT(COLUMN_JSON(COLUMN_CREATE('id', oar_.id, 'title', oar_.title, 'date', DATE_FORMAT(oar_.date, '%Y-%m-%dT%TZ'), 'link', oar_.link))), ']') as articles
                 FROM (SELECT * FROM OrganizationArticle WHERE link is not null and link != '' ORDER BY date DESC) as oar_

+ 1 - 1
src/Entity/Billing/AbstractBillingIntangible.php

@@ -22,7 +22,7 @@ use Doctrine\Common\Collections\Collection;
     'access' => 'AccessIntangible',
     'educationalproject' => 'EducationalProjectIntangible'
 ])]
-abstract class AbstractBillingIntangible{
+abstract class AbstractBillingIntangible {
     #[ORM\Id]
     #[ORM\Column]
     #[ORM\GeneratedValue]

+ 3 - 3
src/Entity/Billing/EducationalProjectIntangible.php

@@ -14,12 +14,12 @@ use Doctrine\ORM\Mapping as ORM;
  */
 //#[Auditable]
 #[ORM\Entity]
-class EducationalProjectIntangible
+class EducationalProjectIntangible extends AbstractBillingIntangible
 {
     #[ORM\Id]
     #[ORM\Column]
     #[ORM\GeneratedValue]
-    private ?int $id = null;
+    protected ?int $id = null;
 
     #[ORM\ManyToOne(inversedBy: 'educationalProjectIntangibles')]
     private EducationalProject $educationalProject;
@@ -78,4 +78,4 @@ class EducationalProjectIntangible
 
         return $this;
     }
-}
+}

+ 68 - 1
src/Entity/Booking/AbstractBooking.php

@@ -7,6 +7,10 @@ use App\Attribute\ActivityYearConstraintAware;
 use App\Attribute\OrganizationDefaultValue;
 use App\Entity\Traits\ActivityYearTrait;
 use Doctrine\ORM\Mapping as ORM;
+use App\Enum\Booking\VisibilityEnum;
+use Ramsey\Uuid\Doctrine\UuidGenerator;
+use Ramsey\Uuid\UuidInterface;
+use Symfony\Component\Validator\Constraints as Assert;
 
 /**
  * Classe ... qui ...
@@ -23,17 +27,44 @@ abstract class AbstractBooking
     #[ORM\GeneratedValue]
     protected ?int $id = null;
 
+    #[ORM\Column]
+    protected string $name;
+
     #[ORM\Column(type: 'datetime', nullable: true)]
     protected ?\DateTimeInterface $datetimeStart = null;
 
     #[ORM\Column(type: 'datetime', nullable: true)]
     protected ?\DateTimeInterface $datetimeEnd = null;
 
+    #[ORM\Column(nullable: false)]
+    #[Assert\Choice(callback: [VisibilityEnum::class, 'toArray'])]
+    protected string $visibility;
+
+    #[ORM\Column(unique: true)]
+    protected string $uuid;
+
     public function getId(): ?int
     {
         return $this->id;
     }
 
+    /**
+     * @return string
+     */
+    public function getName(): string
+    {
+        return $this->name;
+    }
+
+    /**
+     * @param string $name
+     */
+    public function setName(string $name): self
+    {
+        $this->name = $name;
+
+        return $this;
+    }
 
     public function setDatetimeStart(\DateTimeInterface $datetimeStart = null) : self
     {
@@ -58,4 +89,40 @@ abstract class AbstractBooking
     {
         return $this->datetimeEnd;
     }
-}
+
+    /**
+     * @return string|null
+     */
+    public function getVisibility(): ?string
+    {
+        return $this->visibility;
+    }
+
+    /**
+     * @param string|null $visibility
+     */
+    public function setVisibility(?string $visibility): self
+    {
+        $this->visibility = $visibility;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getUuid(): string
+    {
+        return $this->uuid;
+    }
+
+    /**
+     * @param string $uuid
+     */
+    public function setUuid(string $uuid): self
+    {
+        $this->uuid = $uuid;
+
+        return $this;
+    }
+}

+ 248 - 0
src/Entity/Core/AbstractInformation.php

@@ -0,0 +1,248 @@
+<?php
+declare (strict_types=1);
+
+
+namespace App\Entity\Core;
+
+use ApiPlatform\Metadata\GetCollection;
+use ApiPlatform\Metadata\Get;
+use ApiPlatform\Metadata\ApiResource;
+use App\Entity\Access\Access;
+use App\Entity\Organization\Organization;
+use App\Repository\Core\NotificationRepository;
+
+//use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use Doctrine\Common\Collections\ArrayCollection;
+use Doctrine\Common\Collections\Collection;
+use Doctrine\ORM\Mapping as ORM;
+use JetBrains\PhpStorm\Pure;
+use Symfony\Component\Validator\Constraints as Assert;
+use App\Enum\Core\NotificationTypeEnum;
+use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
+use Symfony\Component\Serializer\Annotation\Context;
+
+/**
+ * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table Notification, et supprimer l'attribut discr.
+ *
+ * Classe Notification. qui permet de gérer les notifications aux utilisateurs.
+ */
+//#[ApiResource(
+//    operations: [
+//        new Get(),
+//        new GetCollection(
+//            paginationMaximumItemsPerPage: 20,
+//            paginationClientItemsPerPage: true,
+//            order: ['id' => 'DESC']
+//        )
+//    ]
+//)]
+//#[Auditable]
+#[ORM\Entity]
+#[ORM\Table(name: 'Information')]
+#[ORM\InheritanceType('SINGLE_TABLE')]
+#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
+#[ORM\DiscriminatorMap([
+    'notification' => 'Notification',
+    'tips' => 'Tips'
+])]
+class AbstractInformation
+{
+    #[ORM\Id]
+    #[ORM\Column]
+    #[ORM\GeneratedValue]
+    private ?int $id = null;
+
+    #[ORM\ManyToOne(inversedBy: 'notifications')]
+    #[ORM\JoinColumn(nullable: false)]
+    private ?Access $recipientAccess;
+
+    #[ORM\ManyToOne(inversedBy: 'notifications')]
+    #[ORM\JoinColumn(nullable: false)]
+    private ?Organization $recipientOrganization;
+
+    #[ORM\Column(length: 40, nullable: true)]
+    private ?string $name = null;
+
+    #[ORM\Column(type: 'datetime', nullable: true)]
+    private ?\DateTimeInterface $createDate;
+
+    #[ORM\Column(type: 'datetime', nullable: true)]
+    private ?\DateTimeInterface $updateDate;
+
+    #[ORM\Column(type: 'json', length: 4294967295, nullable: true)]
+    private mixed $message = [];
+
+    #[ORM\Column(nullable: true)]
+    #[Assert\Choice(callback: [NotificationTypeEnum::class, 'toArray'], message: 'invalid-type')]
+    private ?string $type = null;
+
+    #[ORM\Column(length: 255, nullable: true)]
+    private ?string $link = null;
+
+    #[ORM\Column(type: 'date', nullable: true)]
+    #[Context(normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
+    private ?\DateTimeInterface $availabilityDate = null;
+
+    #[ORM\OneToMany(mappedBy: 'notification', targetEntity: NotificationUser::class, cascade: ['persist'], orphanRemoval: true)]
+    private Collection $notificationUsers;
+
+    #[Pure]
+    public function __construct()
+    {
+        $this->notificationUsers = new ArrayCollection();
+    }
+
+    public function getId(): ?int
+    {
+        return $this->id;
+    }
+
+    public function setName(?string $name): self
+    {
+        $this->name = $name;
+        return $this;
+    }
+
+    public function getName(): ?string
+    {
+        return $this->name;
+    }
+
+    public function setRecipientAccess(?Access $recipientAccess): self
+    {
+        $this->recipientAccess = $recipientAccess;
+        return $this;
+    }
+
+    public function getRecipientAccess(): ?Access
+    {
+        return $this->recipientAccess;
+    }
+
+    /**
+     * @return Organization|null
+     */
+    public function getRecipientOrganization(): ?Organization
+    {
+        return $this->recipientOrganization;
+    }
+
+    /**
+     * @param Organization|null $recipientOrganization
+     * @return AbstractInformation
+     */
+    public function setRecipientOrganization(?Organization $recipientOrganization): self
+    {
+        $this->recipientOrganization = $recipientOrganization;
+        return $this;
+    }
+
+    /**
+     * @return \DateTimeInterface|null
+     */
+    public function getCreateDate(): ?\DateTimeInterface
+    {
+        return $this->createDate;
+    }
+
+    /**
+     * @param \DateTimeInterface|null $createDate
+     */
+    public function setCreateDate(?\DateTimeInterface $createDate): self
+    {
+        $this->createDate = $createDate;
+        return $this;
+    }
+
+    /**
+     * @return \DateTimeInterface|null
+     */
+    public function getUpdateDate(): ?\DateTimeInterface
+    {
+        return $this->updateDate;
+    }
+
+    /**
+     * @param \DateTimeInterface|null $updateDate
+     */
+    public function setUpdateDate(?\DateTimeInterface $updateDate): self
+    {
+        $this->updateDate = $updateDate;
+        return $this;
+    }
+
+    public function setMessage(mixed $message): self
+    {
+        $this->message = $message;
+        return $this;
+    }
+
+    public function getMessage(): mixed
+    {
+        if (!is_array($this->message)) {
+            return ['about' => $this->message];
+        }
+        return $this->message;
+    }
+
+    public function setType(?string $type): self
+    {
+        $this->type = $type;
+        return $this;
+    }
+
+    public function getType(): ?string
+    {
+        return $this->type;
+    }
+
+    public function setLink(?string $link): self
+    {
+        $this->link = $link;
+        return $this;
+    }
+
+    public function getLink(): ?string
+    {
+        return $this->link;
+    }
+
+    public function getAvailabilityDate(): ?\DateTimeInterface
+    {
+        return $this->availabilityDate;
+    }
+
+    public function setAvailabilityDate(?\DateTime $availabilityDate = null): self
+    {
+        if ($availabilityDate == null) {
+            $availabilityDate = new \DateTime();
+        }
+        $this->availabilityDate = $availabilityDate;
+        return $this;
+    }
+
+    public function getNotificationUsers(): Collection
+    {
+        return $this->notificationUsers;
+    }
+
+    public function addNotificationUser(NotificationUser $notificationUsers): self
+    {
+        if (!$this->notificationUsers->contains($notificationUsers)) {
+            $this->notificationUsers[] = $notificationUsers;
+            $notificationUsers->setNotification($this);
+        }
+        return $this;
+    }
+
+    public function removeNotificationUser(NotificationUser $notificationUsers): self
+    {
+        if ($this->notificationUsers->removeElement($notificationUsers)) {
+            // set the owning side to null (unless already changed)
+            if ($notificationUsers->getNotification() === $this) {
+                $notificationUsers->setNotification(null);
+            }
+        }
+        return $this;
+    }
+}

+ 0 - 1
src/Entity/Core/File.php

@@ -19,7 +19,6 @@ use App\Enum\Core\FileHostEnum;
 use App\Repository\Core\FileRepository;
 use App\Entity\Organization\Parameters;
 use DateTime;
-
 //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;

+ 1 - 16
src/Entity/Core/Notification.php

@@ -38,17 +38,13 @@ use Symfony\Component\Serializer\Annotation\Context;
 )]
 //#[Auditable]
 #[ORM\Entity(repositoryClass: NotificationRepository::class)]
-#[ORM\Table(name: 'Information')]
-class Notification
+class Notification extends AbstractInformation
 {
     #[ORM\Id]
     #[ORM\Column]
     #[ORM\GeneratedValue]
     private ?int $id = null;
 
-    #[ORM\Column(length: 255, nullable: false)]
-    private string $discr = 'notification';
-
     #[ORM\ManyToOne(inversedBy: 'notifications')]
     #[ORM\JoinColumn(nullable: false)]
     private ?Access $recipientAccess;
@@ -242,15 +238,4 @@ class Notification
         }
         return $this;
     }
-
-    public function getDiscr(): ?string
-    {
-        return $this->discr;
-    }
-
-    public function setDiscr(string $discr): self
-    {
-        $this->discr = $discr;
-        return $this;
-    }
 }

+ 6 - 5
src/Entity/Core/NotificationUser.php

@@ -10,11 +10,12 @@ use App\Entity\Access\Access;
 use App\Repository\Core\NotificationUserRepository;
 
 //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
- *
- * Les NotificationUser permettent de garder la trace des notifications qui ont été lues par les utilisateurs
+ * Les NotificationUser permettent de garder la trace des notifications et des tips
+ * qui ont été lues par les utilisateurs
  */
 #[ApiResource(
     operations: [
@@ -36,7 +37,7 @@ class NotificationUser
 
     #[ORM\ManyToOne(inversedBy: 'notificationUsers')]
     #[ORM\JoinColumn(nullable: false)]
-    private Notification $notification;
+    private AbstractInformation $notification;
 
     #[ORM\ManyToOne(inversedBy: 'notificationUsers')]
     #[ORM\JoinColumn(nullable: false)]
@@ -50,13 +51,13 @@ class NotificationUser
         return $this->id;
     }
 
-    public function setNotification(?Notification $notification): self
+    public function setNotification(?AbstractInformation $notification): self
     {
         $this->notification = $notification;
         return $this;
     }
 
-    public function getNotification(): Notification
+    public function getNotification(): AbstractInformation
     {
         return $this->notification;
     }

+ 17 - 2
src/Entity/Core/Tips.php

@@ -4,14 +4,29 @@ declare(strict_types=1);
 namespace App\Entity\Core;
 
 //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use ApiPlatform\Metadata\ApiResource;
+use ApiPlatform\Metadata\Get;
+use ApiPlatform\Metadata\GetCollection;
+use App\Repository\Core\NotificationRepository;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
  * Classe ... qui ...
  */
 //#[Auditable]
+#[ApiResource(
+    operations: [
+        new Get(),
+        new GetCollection(
+            paginationMaximumItemsPerPage: 20,
+            paginationClientItemsPerPage: true,
+            order: ['id' => 'DESC']
+        )
+    ]
+)]
+//#[Auditable]
 #[ORM\Entity]
-class Tips
+class Tips extends AbstractInformation
 {
     #[ORM\Id]
     #[ORM\Column]
@@ -22,4 +37,4 @@ class Tips
     {
         return $this->id;
     }
-}
+}

+ 2 - 1
src/Entity/Organization/Organization.php

@@ -209,7 +209,8 @@ class Organization
     private ?string $ffecApproval = null;
 
     #[ORM\Column]
-    private bool $portailVisibility;
+    private bool $portailVisibility = true;
+
     #[ORM\Column(nullable: true)]
     private ?int $cmsId = null;
 

+ 2 - 2
src/Entity/Organization/Parameters.php

@@ -147,9 +147,9 @@ class Parameters
     #[Assert\Choice(callback: ['\\App\\Enum\\Core\\TimeZoneEnum', 'toArray'], message: 'invalid-timezone')]
     private ?string $timezone = "Europe/Paris";
 
-    #[ORM\Column(length: 255, nullable: true, options: ['default' => 'ANNUAL'])]
+    #[ORM\Column(length: 255, nullable: false, options: ['default' => 'ANNUAL'])]
     #[Assert\Choice(callback: ['\\App\\Enum\\Education\\PeriodicityEnum', 'toArray'], message: 'invalid-periodicity')]
-    private ?string $educationPeriodicity = null;
+    private ?string $educationPeriodicity = 'ANNUAL';
 
     #[ORM\Column(length: 255, nullable: true, options: ['default' => 'BY_EDUCATION'])]
     #[Assert\Choice(callback: ['\\App\\Enum\\Education\\AdvancedEducationNotationTypeEnum', 'toArray'], message: 'invalid-advanced-education-notation-type')]

+ 7 - 15
src/Entity/Place/Place.php

@@ -35,11 +35,14 @@ use Doctrine\ORM\Mapping as ORM;
 //#[Auditable]
 #[ORM\Entity]
 #[ORM\Table(name: 'Place')]
+#[ORM\InheritanceType('SINGLE_TABLE')]
+#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
+#[ORM\DiscriminatorMap([
+    'place' => 'Place',
+    'place_system' => 'PlaceSystem'
+])]
 class Place
 {
-    #[ORM\Column(length: 255, nullable: false)]
-    private string $discr = 'place';
-
     #[ORM\Id]
     #[ORM\Column]
     #[ORM\GeneratedValue]
@@ -106,17 +109,6 @@ class Place
         $this->equipmentUseds = new ArrayCollection();
     }
 
-    public function getDiscr(): ?string
-    {
-        return $this->discr;
-    }
-
-    public function setDiscr(string $discr): self
-    {
-        $this->discr = $discr;
-        return $this;
-    }
-
     public function getId(): ?int
     {
         return $this->id;
@@ -439,4 +431,4 @@ class Place
         }
         return $this;
     }
-}
+}

+ 2 - 2
src/Entity/Public/FederationStructure.php

@@ -49,7 +49,7 @@ class FederationStructure
     #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
     private ?string $name;
 
-    #[ORM\Column(type: 'integer')]
+    #[ORM\Column(type: 'integer', nullable: true)]
     #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
     private ?int $logoId;
 
@@ -65,7 +65,7 @@ class FederationStructure
     #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
     private ?string $type;
 
-    #[ORM\Column]
+    #[ORM\Column(nullable: true)]
     #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
     private ?string $website;
 

+ 16 - 0
src/Enum/Booking/VisibilityEnum.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Enum\Booking;
+
+use MyCLabs\Enum\Enum;
+
+/**
+ * Visibilité des évènements
+ * @method static PRIVATE_VISIBILITY()
+ * @method static PUBLIC_VISIBILITY()
+ */
+class VisibilityEnum extends Enum
+{
+    private const PRIVATE_VISIBILITY = 'PRIVATE_VISIBILITY';
+    private const PUBLIC_VISIBILITY = 'PUBLIC_VISIBILITY';
+}

+ 1 - 0
src/Service/Security/InternalRequestsService.php

@@ -10,6 +10,7 @@ namespace App\Service\Security;
 class InternalRequestsService
 {
     // Internal ips allowed to access private files without being authenticated
+    // TODO: voir à déplacer cette array dans la conf ou dans le .env?
     const INTERNAL_IPS = [
         '/^127\.0\.0\.[0-1]$/', // Localhost
         '/^localhost$/',  // Localhost

+ 65 - 0
tests/Application/OtWebTestCase.php

@@ -0,0 +1,65 @@
+<?php
+
+namespace App\Tests\Application;
+
+use App\Entity\Public\FederationStructure;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\DomCrawler\Crawler;
+use ApiPlatform\Symfony\Bundle\Test\Client;
+use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
+use Symfony\Contracts\HttpClient\ResponseInterface;
+
+/**
+ * Base class for applicative tests
+ */
+abstract class OtWebTestCase extends ApiTestCase
+{
+    protected Client $client;
+
+    public function setup(): void {
+        $this->client = static::createClient();
+    }
+
+    /**
+     * Send a requests, parse the hydra response and return an object or a Collection
+     *
+     * @param string $method
+     * @param string $route
+     * @param array<mixed> $parameters
+     * @return ResponseInterface
+     */
+    protected function request(string $method, string $route, array $parameters = []): ResponseInterface {
+        return $this->client->request(
+            $method,
+            $route,
+            $parameters
+        );
+    }
+
+    /**
+     * Send a GET request and return the response parsed content
+     *
+     * @param string $route
+     * @param array<mixed> $parameters
+     * @return ResponseInterface
+     */
+    protected function get(string $route, array $parameters = []): ResponseInterface {
+        return $this->request(
+            Request::METHOD_GET,
+            $route,
+            $parameters
+        );
+    }
+
+    protected function validateCollectionSchema(string $resourceClass): void {
+        $this->assertResponseIsSuccessful();
+
+        // Asserts that the returned content type is JSON-LD (the default)
+        $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');
+
+        // Asserts that the returned JSON is validated by the JSON Schema generated for this resource by API Platform
+        // >>> Issue with the json typed PublicStructure::addresses properties
+        // $this->assertMatchesResourceCollectionJsonSchema($resourceClass);
+    }
+
+}

+ 26 - 0
tests/Application/Public/PublicEventsTest.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Tests\Application\Public;
+use App\Entity\Public\PublicEvent;
+use App\Tests\Application\OtWebTestCase;
+
+class PublicEventsTest extends OtWebTestCase
+{
+
+    public function testEvents(): void
+    {
+        $this->get('/api/public/events');
+
+        $this->validateCollectionSchema(PublicEvent::class);
+
+        $this->assertJsonContains([
+            '@context' => '/api/contexts/PublicEvent',
+            '@id' => '/api/public/events',
+            '@type' => 'hydra:Collection',
+            'hydra:totalItems' => 1,
+            'hydra:member' => [
+                ["name" => "My Event"]
+            ],
+        ]);
+    }
+}

+ 27 - 0
tests/Application/Public/PublicStructuresTest.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Tests\Application\Public;
+
+use App\Entity\Public\FederationStructure;
+use App\Tests\Application\OtWebTestCase;
+
+class PublicStructuresTest extends OtWebTestCase
+{
+    public function testGetIndex(): void
+    {
+        $crawler = $this->get('api/public/federation_structures');
+
+        $this->validateCollectionSchema(FederationStructure::class);
+
+        $this->assertJsonContains([
+            '@context' => '/api/contexts/FederationStructure',
+            '@id' => '/api/public/federation_structures',
+            '@type' => 'hydra:Collection',
+            'hydra:totalItems' => 2,
+            'hydra:member' => [
+                ["name" => "Fede 1"],
+                ["name" => "Organization 2"],
+            ],
+        ]);
+    }
+}

+ 111 - 0
tests/Fixture/OrganizationFixtures.php

@@ -0,0 +1,111 @@
+<?php
+
+namespace App\Tests\Fixture;
+
+use App\Entity\Booking\Event;
+use App\Entity\Core\ContactPoint;
+use App\Entity\Network\Network;
+use App\Entity\Network\NetworkOrganization;
+use App\Entity\Organization\Organization;
+use App\Entity\Organization\Parameters;
+use App\Enum\Booking\VisibilityEnum;
+use App\Enum\Core\ContactPointTypeEnum;
+use App\Enum\Organization\LegalEnum;
+use App\Enum\Organization\PrincipalTypeEnum;
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Persistence\ObjectManager;
+use Symfony\Component\Serializer\Context\SerializerContextBuilder;
+use App\Service\Utils\Uuid;
+
+class OrganizationFixtures extends Fixture
+{
+    public function load(ObjectManager $em): void
+    {
+        $network = new Network();
+        $network->setName('NET');
+        $em->persist($network);
+
+        // Create the root organization (opentalent)
+        $parameters0 = new Parameters();
+        $em->persist($parameters0);
+
+        $contactPoint0 = new ContactPoint();
+        $contactPoint0->setContactType(ContactPointTypeEnum::PRINCIPAL()->getValue());
+        $em->persist($contactPoint0);
+
+        $root = new Organization();
+        $root->setName('Root');
+        $root->setLegalStatus(LegalEnum::COMMERCIAL_SOCIETY()->getValue());
+        $root->setPrincipalType(PrincipalTypeEnum::NATIONAL_FEDERATION()->getValue());
+        $root->setParameters($parameters0);
+        $root->addContactPoint($contactPoint0);
+        $em->persist($root);
+
+        $networkOrganisation0 = new NetworkOrganization();
+        $networkOrganisation0->setOrganization($root);
+        $networkOrganisation0->setNetwork($network);
+        $em->persist($networkOrganisation0);
+
+
+        // Create a federation organization
+        $parameters1 = new Parameters();
+        $em->persist($parameters1);
+
+        $contactPoint1 = new ContactPoint();
+        $contactPoint1->setContactType(ContactPointTypeEnum::PRINCIPAL()->getValue());
+        $em->persist($contactPoint1);
+
+        $fede = new Organization();
+        $fede->setName('Fede 1');
+        $fede->setLegalStatus(LegalEnum::ASSOCIATION_LAW_1901()->getValue());
+        $fede->setPrincipalType(PrincipalTypeEnum::NATIONAL_FEDERATION()->getValue());
+        $fede->setParameters($parameters1);
+        $fede->addContactPoint($contactPoint1);
+        $em->persist($fede);
+
+        $networkOrganisation1 = new NetworkOrganization();
+        $networkOrganisation1->setOrganization($fede);
+        $networkOrganisation1->setNetwork($network);
+        $networkOrganisation1->setParent($root);
+        $em->persist($networkOrganisation1);
+
+        // Create a simple organization
+        $parameters2 = new Parameters();
+        $em->persist($parameters2);
+
+        $contactPoint2 = new ContactPoint();
+        $contactPoint2->setContactType(ContactPointTypeEnum::PRINCIPAL()->getValue());
+        $em->persist($contactPoint2);
+
+        $organization = new Organization();
+        $organization->setName('Organization 2');
+        $organization->setLegalStatus(LegalEnum::ASSOCIATION_LAW_1901()->getValue());
+        $organization->setPrincipalType(PrincipalTypeEnum::ARTISTIC_EDUCATION_ONLY()->getValue());
+        $organization->setParameters($parameters2);
+        $organization->addContactPoint($contactPoint2);
+        $em->persist($organization);
+
+        $networkOrganisation2 = new NetworkOrganization();
+        $networkOrganisation2->setOrganization($organization);
+        $networkOrganisation2->setNetwork($network);
+        $networkOrganisation2->setParent($fede);
+        $em->persist($networkOrganisation2);
+
+
+        // Booking
+        $now = new \DateTime('now');
+        $start = $now->add(new \DateInterval('P1M'));
+        $end = $now->add(new \DateInterval('P1M1D'));
+
+        $event = new Event();
+        $event->setOrganization($organization);
+        $event->setName('My Event');
+        $event->setDatetimeStart($start);
+        $event->setDatetimeEnd($end);
+        $event->setVisibility(VisibilityEnum::PUBLIC_VISIBILITY());
+        $event->setUuid(Uuid::uuid());
+        $em->persist($event);
+
+        $em->flush();
+    }
+}

+ 16 - 0
tests/Fixture/readme.md

@@ -0,0 +1,16 @@
+# Générer la DB de test et charger les fixtures
+
+Pour regénérer le SQL de création de la DB de test :
+
+    mysqldump --user=root --password=mysql660 --host=localhost --port=3306 --default-character-set=utf8 --single-transaction=TRUE --no-data --skip-triggers "opentalent" --column-statistics=0 > opentalent_test.sql
+
+    mysql --user=root --password=mysql660 --host=127.0.0.1 --port=3306 -D opentalent_test < opentalent_test.sql
+
+Il peut être nécessaire de regénérer les vues :
+
+    bin/console --env=staging doctrine:schema:update
+
+
+Pour recharger les fixtures :
+
+    bin/console --env=staging doctrine:fixtures:load

+ 3 - 3
tests/Filter/DoctrineFilter/DateTimeFilterTest.php → tests/Unit/Filter/DoctrineFilter/DateTimeFilterTest.php

@@ -1,8 +1,8 @@
 <?php
-namespace App\Tests\Filter\DoctrineFilter;
+namespace App\Tests\Unit\Filter\DoctrineFilter;
 
 use App\Filter\DoctrineFilter\DateTimeFilter;
-use App\Tests\TestToolsTrait;
+use App\Tests\Unit\TestToolsTrait;
 use Doctrine\ORM\EntityManagerInterface;
 use PHPUnit\Framework\TestCase;
 
@@ -73,4 +73,4 @@ class DateTimeFilterTest extends TestCase
         $this->assertEquals('>', $this->invokeMethod($this->dateTimeFilter, 'getArithmeticValue', [5]));
         $this->assertEquals(null, $this->invokeMethod($this->dateTimeFilter, 'getArithmeticValue', [0]));
     }
-}
+}

+ 1 - 1
tests/Service/Access/AccessProfileCreatorTest.php → tests/Unit/Service/Access/AccessProfileCreatorTest.php

@@ -1,5 +1,5 @@
 <?php
-namespace App\Tests\Service\Access;
+namespace App\Tests\Unit\Service\Access;
 
 use App\ApiResources\Profile\AccessProfile;
 use App\ApiResources\Profile\OrganizationProfile;

+ 1 - 1
tests/Service/Access/AdminAccessUtilsTest.php → tests/Unit/Service/Access/AdminAccessUtilsTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Access;
+namespace App\Tests\Unit\Service\Access;
 
 use App\ApiResources\Access\AdminAccess;
 use App\Entity\Access\Access;

+ 1 - 1
tests/Service/Access/OptionalsRoles/CriteriaNotationOptionalRoleTest.php → tests/Unit/Service/Access/OptionalsRoles/CriteriaNotationOptionalRoleTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Access\OptionalsRoles;
+namespace App\Tests\Unit\Service\Access\OptionalsRoles;
 
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;

+ 1 - 1
tests/Service/Access/UtilsTest.php → tests/Unit/Service/Access/UtilsTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Access;
+namespace App\Tests\Unit\Service\Access;
 
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;

+ 2 - 3
tests/Service/ApiLegacy/ApiLegacyRequestServiceTest.php → tests/Unit/Service/ApiLegacy/ApiLegacyRequestServiceTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\ApiLegacy;
+namespace App\Tests\Unit\Service\ApiLegacy;
 
 use App\Entity\Access\Access;
 use App\Entity\Person\Person;
@@ -8,11 +8,10 @@ use App\Service\ApiLegacy\ApiLegacyRequestService;
 use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
+use Symfony\Bundle\SecurityBundle\Security;
 use Symfony\Component\HttpKernel\Exception\HttpException;
-use Symfony\Component\Security\Core\Authentication\Token\NullToken;
 use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
 use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
-use Symfony\Bundle\SecurityBundle\Security;
 use Symfony\Contracts\HttpClient\HttpClientInterface;
 use Symfony\Contracts\HttpClient\ResponseInterface;
 

+ 2 - 2
tests/Service/Constraint/AbstractTimeConstraintsUtilsTest.php → tests/Unit/Service/Constraint/AbstractTimeConstraintsUtilsTest.php

@@ -1,9 +1,9 @@
 <?php
 
-namespace App\Tests\Service\Constraint;
+namespace App\Tests\Unit\Service\Constraint;
 
 use App\Service\Constraint\AbstractTimeConstraintUtils;
-use App\Tests\TestToolsTrait;
+use App\Tests\Unit\TestToolsTrait;
 use PHPUnit\Framework\TestCase;
 
 class AbstractTimeConstraintsUtilsTest extends TestCase

+ 1 - 1
tests/Service/Constraint/ActivityYearConstraintTest.php → tests/Unit/Service/Constraint/ActivityYearConstraintTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Constraint;
+namespace App\Tests\Unit\Service\Constraint;
 
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;

+ 2 - 2
tests/Service/Constraint/DateTimeConstraintTest.php → tests/Unit/Service/Constraint/DateTimeConstraintTest.php

@@ -1,5 +1,5 @@
 <?php
-namespace App\Tests\Service\Constraint;
+namespace App\Tests\Unit\Service\Constraint;
 
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;
@@ -7,7 +7,7 @@ use App\Entity\Organization\Parameters;
 use App\Repository\Access\AccessRepository;
 use App\Service\Constraint\DateTimeConstraint;
 use App\Service\Organization\Utils as OrganizationUtils;
-use App\Tests\TestToolsTrait;
+use App\Tests\Unit\TestToolsTrait;
 use Doctrine\ORM\EntityManagerInterface;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;

+ 1 - 1
tests/Service/Core/AddressPostalUtilsTest.php → tests/Unit/Service/Core/AddressPostalUtilsTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Core;
+namespace App\Tests\Unit\Service\Core;
 
 use App\Entity\Core\AddressPostal;
 use App\Service\Core\AddressPostalUtils;

+ 1 - 1
tests/Service/Core/ContactPointUtilsTest.php → tests/Unit/Service/Core/ContactPointUtilsTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Core;
+namespace App\Tests\Unit\Service\Core;
 
 use App\Entity\Access\Access;
 use App\Entity\Core\ContactPoint;

+ 1 - 1
tests/Service/Cotisation/CotisationCreatorTest.php → tests/Unit/Service/Cotisation/CotisationCreatorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Cotisation;
+namespace App\Tests\Unit\Service\Cotisation;
 
 use App\Entity\Organization\Organization;
 use App\Repository\Organization\OrganizationRepository;

+ 2 - 2
tests/Service/Cotisation/UtilsTest.php → tests/Unit/Service/Cotisation/UtilsTest.php

@@ -1,17 +1,17 @@
 <?php
 
-namespace App\Tests\Service\Cotisation;
+namespace App\Tests\Unit\Service\Cotisation;
 
 use App\Entity\Organization\Organization;
 use App\Enum\Cotisation\AlertStateEnum;
 use App\Repository\Cotisation\CotisationApiResourcesRepository;
 use App\Repository\Network\NetworkOrganizationRepository;
 use App\Service\Cotisation\Utils as CotisationUtils;
+use App\Service\Network\Utils as NetworkUtils;
 use App\Service\Organization\Utils as OrganizationUtils;
 use App\Service\Utils\DatesUtils;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
-use App\Service\Network\Utils as NetworkUtils;
 
 class UtilsTest extends TestCase
 {

+ 1 - 1
tests/Service/Cron/BaseCronJobTest.php → tests/Unit/Service/Cron/BaseCronJobTest.php

@@ -1,5 +1,5 @@
 <?php
-namespace App\Tests\Service\Cron;
+namespace App\Tests\Unit\Service\Cron;
 
 use App\Service\Cron\BaseCronJob;
 use App\Service\Cron\UI\ConsoleUI;

+ 1 - 1
tests/Service/Cron/Job/CleanTempFilesTest.php → tests/Unit/Service/Cron/Job/CleanTempFilesTest.php

@@ -1,5 +1,5 @@
 <?php
-namespace App\Tests\Service\Cron\Job;
+namespace App\Tests\Unit\Service\Cron\Job;
 
 use App\Entity\Access\Access;
 use App\Entity\Core\File;

+ 1 - 1
tests/Service/Cron/Job/DolibarrSyncTest.php → tests/Unit/Service/Cron/Job/DolibarrSyncTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Cron\Job;
+namespace App\Tests\Unit\Service\Cron\Job;
 
 use App\Service\Cron\Job\DolibarrSync;
 use App\Service\Cron\UI\CronUIInterface;

+ 4 - 4
tests/Service/Cron/UI/ConsoleUITest.php → tests/Unit/Service/Cron/UI/ConsoleUITest.php

@@ -1,11 +1,11 @@
 <?php
-namespace App\Tests\Service\Cron\UI;
+namespace App\Tests\Unit\Service\Cron\UI;
 
 use App\Service\Cron\UI\ConsoleUI;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
-use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Helper\ProgressBar;
+use Symfony\Component\Console\Output\OutputInterface;
 
 class TestableConsoleUI extends ConsoleUI {
     public function setProgressBar(ProgressBar $progressBar): void
@@ -26,9 +26,9 @@ class ConsoleUITest extends TestCase
 
     /**
      * @param list<string> $methodNames
-     * @return TestableConsoleUI | MockObject
+     * @return \App\Tests\Service\Cron\UI\TestableConsoleUI | MockObject
      */
-    private function getConsoleUiMockFor(array $methodNames): TestableConsoleUI | MockObject {
+    private function getConsoleUiMockFor(array $methodNames): \App\Tests\Service\Cron\UI\TestableConsoleUI| MockObject {
         return $this->getMockBuilder(TestableConsoleUI::class)
             ->setConstructorArgs([$this->output])
             ->setMethodsExcept($methodNames)

+ 1 - 1
tests/Service/Dolibarr/DolibarrAccountCreatorTest.php → tests/Unit/Service/Dolibarr/DolibarrAccountCreatorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Dolibarr;
+namespace App\Tests\Unit\Service\Dolibarr;
 
 use App\ApiResources\Dolibarr\DolibarrAccount;
 use App\ApiResources\Dolibarr\DolibarrBill;

+ 1 - 1
tests/Service/Dolibarr/DolibarrApiServiceTest.php → tests/Unit/Service/Dolibarr/DolibarrApiServiceTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Dolibarr;
+namespace App\Tests\Unit\Service\Dolibarr;
 
 use App\Service\Dolibarr\DolibarrApiService;
 use PHPUnit\Framework\MockObject\MockObject;

+ 2 - 2
tests/Service/Dolibarr/DolibarrSyncServiceTest.php → tests/Unit/Service/Dolibarr/DolibarrSyncServiceTest.php

@@ -1,6 +1,6 @@
 <?php /** @noinspection ALL */
 
-namespace App\Tests\Service\Dolibarr;
+namespace App\Tests\Unit\Service\Dolibarr;
 
 use App\Entity\Access\Access;
 use App\Entity\Access\FunctionType;
@@ -21,9 +21,9 @@ use App\Enum\Organization\SettingsProductEnum;
 use App\Repository\Access\AccessRepository;
 use App\Repository\Access\FunctionTypeRepository;
 use App\Repository\Organization\OrganizationRepository;
+use App\Service\Core\AddressPostalUtils;
 use App\Service\Dolibarr\DolibarrApiService;
 use App\Service\Dolibarr\DolibarrSyncService;
-use App\Service\Core\AddressPostalUtils;
 use App\Service\Rest\Operation\BaseRestOperation;
 use App\Service\Rest\Operation\CreateOperation;
 use App\Service\Rest\Operation\DeleteOperation;

+ 1 - 1
tests/Service/Education/EducationNotationUtilsTest.php → tests/Unit/Service/Education/EducationNotationUtilsTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Education;
+namespace App\Tests\Unit\Service\Education;
 
 use App\Entity\Access\Access;
 use App\Entity\Education\CriteriaNotation;

+ 1 - 1
tests/Service/Elasticsearch/EducationNotationUpdaterTest.php → tests/Unit/Service/Elasticsearch/EducationNotationUpdaterTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Elasticsearch;
+namespace App\Tests\Unit\Service\Elasticsearch;
 
 use App\Service\Elasticsearch\EducationNotationUpdater;
 use FOS\ElasticaBundle\Persister\ObjectPersister;

+ 1 - 1
tests/Service/Export/BaseExporterTest.php → tests/Unit/Service/Export/BaseExporterTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Export;
+namespace App\Tests\Unit\Service\Export;
 
 use App\ApiResources\Export\ExportRequest;
 use App\Entity\Access\Access;

+ 1 - 1
tests/Service/Export/Encoder/PdfEncoderTest.php → tests/Unit/Service/Export/Encoder/PdfEncoderTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Export\Encoder;
+namespace App\Tests\Unit\Service\Export\Encoder;
 
 use App\Service\Export\Encoder\PdfEncoder;
 use Knp\Snappy\Pdf;

+ 3 - 3
tests/Service/Export/LicenceCmfExporterTest.php → tests/Unit/Service/Export/LicenceCmfExporterTest.php

@@ -1,6 +1,6 @@
 <?php /** @noinspection PhpUnhandledExceptionInspection */
 
-namespace App\Tests\Service\Export;
+namespace App\Tests\Unit\Service\Export;
 
 use App\ApiResources\Export\ExportRequest;
 use App\ApiResources\Export\LicenceCmf\LicenceCmfOrganizationER;
@@ -17,9 +17,9 @@ use App\Service\Export\Encoder\PdfEncoder;
 use App\Service\Export\LicenceCmfExporter;
 use App\Service\Export\Model\LicenceCmf;
 use App\Service\File\FileManager;
-use App\Service\ServiceIterator\EncoderIterator;
 use App\Service\File\Storage\LocalStorage;
-use App\Tests\TestToolsTrait;
+use App\Service\ServiceIterator\EncoderIterator;
+use App\Tests\Unit\TestToolsTrait;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\EntityManagerInterface;
 use PHPUnit\Framework\MockObject\MockObject;

+ 1 - 1
tests/Service/Export/Model/LicenceCmfCollectionTest.php → tests/Unit/Service/Export/Model/LicenceCmfCollectionTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Export\Model;
+namespace App\Tests\Unit\Service\Export\Model;
 
 use App\Service\Export\Model\LicenceCmf;
 use App\Service\Export\Model\LicenceCmfCollection;

+ 1 - 1
tests/Service/Export/Model/LicenceCmfTest.php → tests/Unit/Service/Export/Model/LicenceCmfTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Export\Model;
+namespace App\Tests\Unit\Service\Export\Model;
 
 use App\Entity\Core\File;
 use App\Service\Export\Model\LicenceCmf;

+ 1 - 1
tests/Service/File/FileManagerTest.php → tests/Unit/Service/File/FileManagerTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\File;
+namespace App\Tests\Unit\Service\File;
 
 use ApiPlatform\Api\IriConverterInterface;
 use ApiPlatform\Api\UrlGeneratorInterface;

+ 1 - 1
tests/Service/File/Storage/ApiLegacyStorageTest.php → tests/Unit/Service/File/Storage/ApiLegacyStorageTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\File\Storage;
+namespace App\Tests\Unit\Service\File\Storage;
 
 use App\Entity\Core\File;
 use App\Service\ApiLegacy\ApiLegacyRequestService;

+ 1 - 1
tests/Service/File/Storage/LocalStorageTest.php → tests/Unit/Service/File/Storage/LocalStorageTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\File\Storage;
+namespace App\Tests\Unit\Service\File\Storage;
 
 use ApiPlatform\Core\Api\IriConverterInterface;
 use App\Entity\Access\Access;

+ 2 - 2
tests/Service/Mailer/Builder/AbstractBuilderTest.php → tests/Unit/Service/Mailer/Builder/AbstractBuilderTest.php

@@ -1,7 +1,7 @@
 <?php
 declare(strict_types=1);
 
-namespace App\Tests\Service\Mailer\Builder;
+namespace App\Tests\Unit\Service\Mailer\Builder;
 
 use App\Entity\Access\Access;
 use App\Entity\Core\ContactPoint;
@@ -176,4 +176,4 @@ class AbstractBuilderTest extends TestCase
 
         $this->assertEquals('foo.bar@opentalent.fr', $contactPoint->getEmail());
     }
-}
+}

+ 2 - 2
tests/Service/Mailer/Builder/OnSubdomainChangeMailBuilderTest.php → tests/Unit/Service/Mailer/Builder/OnSubdomainChangeMailBuilderTest.php

@@ -1,7 +1,7 @@
 <?php
 declare(strict_types=1);
 
-namespace App\Tests\Service\Mailer\Builder;
+namespace App\Tests\Unit\Service\Mailer\Builder;
 
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;
@@ -115,4 +115,4 @@ class OnSubdomainChangeMailBuilderTest extends TestCase
         $this->assertEquals($this->opentalentNoReplyEmailAddress, $email->getFrom());
         $this->assertEquals($organization->getName(), $email->geFromName());
     }
-}
+}

+ 2 - 2
tests/Service/Mailer/MailerTest.php → tests/Unit/Service/Mailer/MailerTest.php

@@ -1,7 +1,7 @@
 <?php
 declare(strict_types=1);
 
-namespace App\Tests\Service\Mailer;
+namespace App\Tests\Unit\Service\Mailer;
 
 use App\Entity\Access\Access;
 use App\Entity\Message\ReportEmail;
@@ -430,4 +430,4 @@ class MailerTest extends TestCase
         $this->assertCount(1, $symfonyMail->getBcc());
         $this->assertCount(0, $symfonyMail->getCc());
     }
-}
+}

+ 1 - 1
tests/Service/MercureHubTest.php → tests/Unit/Service/MercureHubTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service;
+namespace App\Tests\Unit\Service;
 
 use ApiPlatform\Api\IriConverterInterface;
 use App\Entity\Organization\Organization;

+ 1 - 1
tests/Service/Mobyt/MobytServiceTest.php → tests/Unit/Service/Mobyt/MobytServiceTest.php

@@ -1,6 +1,6 @@
 <?php /** @noinspection PhpUnhandledExceptionInspection */
 
-namespace App\Tests\Service\Mobyt;
+namespace App\Tests\Unit\Service\Mobyt;
 
 use App\Service\Mobyt\MobytService;
 use PHPUnit\Framework\TestCase;

+ 2 - 2
tests/Service/Mobyt/MobytUserStatusCreatorTest.php → tests/Unit/Service/Mobyt/MobytUserStatusCreatorTest.php

@@ -1,12 +1,12 @@
 <?php
 
-namespace App\Tests\Service\Mobyt;
+namespace App\Tests\Unit\Service\Mobyt;
 
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Parameters;
 use App\Repository\Organization\OrganizationRepository;
-use App\Service\Mobyt\MobytService;
 use App\Service\ApiResourceBuilder\Mobyt\MobytUserStatusBuilder;
+use App\Service\Mobyt\MobytService;
 use PHPUnit\Framework\TestCase;
 
 class MobytUserStatusCreatorTest extends TestCase

+ 2 - 2
tests/Service/Network/TreeTest.php → tests/Unit/Service/Network/TreeTest.php

@@ -1,10 +1,10 @@
 <?php
-namespace App\Tests\Service\Network;
+namespace App\Tests\Unit\Service\Network;
 
 use App\Entity\Organization\Organization;
 use App\Repository\Network\NetworkOrganizationRepository;
-use PHPUnit\Framework\TestCase;
 use App\Service\Network\Tree;
+use PHPUnit\Framework\TestCase;
 
 class TreeTest extends TestCase
 {

+ 2 - 2
tests/Service/Network/UtilsTest.php → tests/Unit/Service/Network/UtilsTest.php

@@ -1,15 +1,15 @@
 <?php /** @noinspection PhpUnhandledExceptionInspection */
 
-namespace App\Tests\Service\Network;
+namespace App\Tests\Unit\Service\Network;
 
 use App\Entity\Network\Network;
 use App\Entity\Network\NetworkOrganization;
 use App\Entity\Organization\Organization;
 use App\Enum\Network\NetworkEnum;
+use App\Service\Network\Utils as NetworkUtils;
 use DateTime;
 use Doctrine\Common\Collections\ArrayCollection;
 use PHPUnit\Framework\TestCase;
-use App\Service\Network\Utils as NetworkUtils;
 
 class UtilsTest extends TestCase
 {

+ 1 - 1
tests/Service/NotifierTest.php → tests/Unit/Service/NotifierTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service;
+namespace App\Tests\Unit\Service;
 
 use App\Entity\Access\Access;
 use App\Entity\Core\File;

+ 1 - 1
tests/Service/OnChange/OnChangeContextTest.php → tests/Unit/Service/OnChange/OnChangeContextTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\OnChange;
+namespace App\Tests\Unit\Service\OnChange;
 
 use App\Service\OnChange\OnChangeContext;
 use PHPUnit\Framework\TestCase;

+ 1 - 1
tests/Service/OnChange/OnChangeDefaultTest.php → tests/Unit/Service/OnChange/OnChangeDefaultTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\OnChange;
+namespace App\Tests\Unit\Service\OnChange;
 
 use App\Service\OnChange\OnChangeContext;
 use App\Service\OnChange\OnChangeDefault;

+ 1 - 1
tests/Service/OnChange/Organization/OnOrganizationChangeTest.php → tests/Unit/Service/OnChange/Organization/OnOrganizationChangeTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\OnChange\Organization;
+namespace App\Tests\Unit\Service\OnChange\Organization;
 
 use App\Entity\Billing\BillingSetting;
 use App\Entity\Organization\Organization;

+ 1 - 1
tests/Service/OnChange/Organization/OnParametersChangeTest.php → tests/Unit/Service/OnChange/Organization/OnParametersChangeTest.php

@@ -2,7 +2,7 @@
 
 /** @noinspection PhpUnhandledExceptionInspection */
 
-namespace App\Tests\Service\OnChange\Organization;
+namespace App\Tests\Unit\Service\OnChange\Organization;
 
 use App\Entity\Access\Access;
 use App\Entity\Booking\Course;

+ 1 - 1
tests/Service/Organization/OrganizationProfileCreatorTest.php → tests/Unit/Service/Organization/OrganizationProfileCreatorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Organization;
+namespace App\Tests\Unit\Service\Organization;
 
 use App\ApiResources\Profile\OrganizationProfile;
 use App\Entity\Network\Network;

+ 1 - 1
tests/Service/Organization/UtilsTest.php → tests/Unit/Service/Organization/UtilsTest.php

@@ -1,6 +1,6 @@
 <?php /** @noinspection PhpUnhandledExceptionInspection */
 
-namespace App\Tests\Service\Organization;
+namespace App\Tests\Unit\Service\Organization;
 
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Parameters;

+ 2 - 2
tests/Service/Rest/ApiRequestServiceTest.php → tests/Unit/Service/Rest/ApiRequestServiceTest.php

@@ -1,13 +1,13 @@
 <?php
 
-namespace App\Tests\Service\Rest;
+namespace App\Tests\Unit\Service\Rest;
 
 use App\Service\Rest\ApiRequestService;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\HttpClient\Exception\TransportException;
+use Symfony\Component\HttpKernel\Exception\HttpException;
 use Symfony\Contracts\HttpClient\HttpClientInterface;
 use Symfony\Contracts\HttpClient\ResponseInterface;
-use Symfony\Component\HttpKernel\Exception\HttpException;
 
 class ApiRequestServiceTest extends TestCase
 {

+ 1 - 1
tests/Service/Rest/Operation/BaseRestOperationTest.php → tests/Unit/Service/Rest/Operation/BaseRestOperationTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Rest\Operation;
+namespace App\Tests\Unit\Service\Rest\Operation;
 
 use App\Service\Rest\ApiRequestService;
 use App\Service\Rest\Operation\BaseRestOperation;

+ 1 - 1
tests/Service/Rest/Operation/CreateOperationTest.php → tests/Unit/Service/Rest/Operation/CreateOperationTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Rest\Operation;
+namespace App\Tests\Unit\Service\Rest\Operation;
 
 use App\Service\Rest\Operation\CreateOperation;
 use PHPUnit\Framework\TestCase;

+ 1 - 1
tests/Service/Rest/Operation/DeleteOperationTest.php → tests/Unit/Service/Rest/Operation/DeleteOperationTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Rest\Operation;
+namespace App\Tests\Unit\Service\Rest\Operation;
 
 use App\Service\Rest\Operation\DeleteOperation;
 use PHPUnit\Framework\TestCase;

+ 1 - 1
tests/Service/Rest/Operation/UpdateOperationTest.php → tests/Unit/Service/Rest/Operation/UpdateOperationTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Rest\Operation;
+namespace App\Tests\Unit\Service\Rest\Operation;
 
 use App\Service\Rest\Operation\UpdateOperation;
 use PHPUnit\Framework\TestCase;

+ 1 - 1
tests/Service/Security/InternalRequestsServiceTest.php → tests/Unit/Service/Security/InternalRequestsServiceTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Security;
+namespace App\Tests\Unit\Service\Security;
 
 use App\Service\Security\InternalRequestsService;
 use PHPUnit\Framework\MockObject\MockObject;

+ 1 - 1
tests/Service/Security/ModuleTest.php → tests/Unit/Service/Security/ModuleTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Security;
+namespace App\Tests\Unit\Service\Security;
 
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Settings;

+ 1 - 1
tests/Service/Security/SwitchUserTest.php → tests/Unit/Service/Security/SwitchUserTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Security;
+namespace App\Tests\Unit\Service\Security;
 
 use App\Entity\Access\Access;
 use App\Service\Security\SwitchUser;

+ 1 - 1
tests/Service/ServiceIterator/CronjobIteratorTest.php → tests/Unit/Service/ServiceIterator/CronjobIteratorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\ServiceIterator;
+namespace App\Tests\Unit\Service\ServiceIterator;
 
 use App\Service\Cron\CronjobInterface;
 use App\Service\ServiceIterator\CronjobIterator;

+ 1 - 1
tests/Service/ServiceIterator/CurrentAccessExtensionIteratorTest.php → tests/Unit/Service/ServiceIterator/CurrentAccessExtensionIteratorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\ServiceIterator;
+namespace App\Tests\Unit\Service\ServiceIterator;
 
 use App\Doctrine\Access\AccessExtensionInterface;
 use App\Service\ServiceIterator\CurrentAccessExtensionIterator;

+ 1 - 1
tests/Service/ServiceIterator/EncoderIteratorTest.php → tests/Unit/Service/ServiceIterator/EncoderIteratorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\ServiceIterator;
+namespace App\Tests\Unit\Service\ServiceIterator;
 
 use App\Service\Export\Encoder\EncoderInterface;
 use App\Service\ServiceIterator\EncoderIterator;

+ 1 - 1
tests/Service/ServiceIterator/ExporterIteratorTest.php → tests/Unit/Service/ServiceIterator/ExporterIteratorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\ServiceIterator;
+namespace App\Tests\Unit\Service\ServiceIterator;
 
 use App\ApiResources\Export\ExportRequest;
 use App\Service\Export\ExporterInterface;

+ 1 - 1
tests/Service/ServiceIterator/Mailer/BuilderIteratorTest.php → tests/Unit/Service/ServiceIterator/Mailer/BuilderIteratorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\ServiceIterator\Mailer;
+namespace App\Tests\Unit\Service\ServiceIterator\Mailer;
 
 use App\Service\Mailer\Builder\BuilderInterface;
 use App\Service\Mailer\Model\MailerModelInterface;

+ 1 - 1
tests/Service/ServiceIterator/OptionalsRolesIteratorTest.php → tests/Unit/Service/ServiceIterator/OptionalsRolesIteratorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\ServiceIterator;
+namespace App\Tests\Unit\Service\ServiceIterator;
 
 use App\Entity\Access\Access;
 use App\Service\Access\OptionalsRolesInterface;

+ 1 - 1
tests/Service/Twig/AssetsExtensionTest.php → tests/Unit/Service/Twig/AssetsExtensionTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Tests\Service\Twig;
+namespace App\Tests\Unit\Service\Twig;
 
 use App\Entity\Core\File;
 use App\Service\File\FileManager;

Някои файлове не бяха показани, защото твърде много файлове са промени