diff --git a/.env.dist b/.env.dist
index 83a4550..a399d2f 100644
--- a/.env.dist
+++ b/.env.dist
@@ -35,3 +35,6 @@ SCW_BUCKET=changeme
SCW_SECRET_KEY=changeme
SCW_DEFAULT_ORGANIZATION_ID=changeme
SCW_DEFAULT_PROJECT_ID=changeme
+
+# Uniquement requis en environnement de test
+MAILPIT_URL=http://mailpit:8025
\ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..9877f7a
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,110 @@
+name: Test
+
+on:
+ push:
+ branches:
+ - '**'
+
+env:
+ APP_ENV: test
+ APP_SECRET: bafc23a0315b735289c499a886798934
+ APP_DEBUG: false
+ DATABASE_URL: pgsql://precontentieux:precontentieux@localhost:5432/precontest?serverVersion=15
+ PRECONTENTIEUX_COURRIEL_EQUIPE: equipe@precontentieux.anje-justice.test
+ COMPOSER_ALLOW_SUPERUSER: 1
+ BASE_URL: precontentieux.test
+ MAILER_FROM: ne-pas-repondre@precontentieux.test
+ MAILER_DSN: smtp://localhost:1025
+ MAILPIT_URL: http://localhost:8025
+ CORS_ALLOW_ORIGIN: "*"
+ EMAIL_FROM: ne-pas-repondre@precontentieux.anje-justice.test
+ EMAIL_FROM_LABEL: "Mon Indemnisation Justice (test)"
+ SYMFONY_DEPRECATIONS_HELPER: disabled
+ PANTHER_ERROR_SCREENSHOT_DIR: public/screenshots
+ PANTHER_ERROR_SCREENSHOT_ATTACH: true
+
+permissions:
+ contents: read
+ issues: read
+ checks: write
+ pull-requests: write
+
+jobs:
+ test:
+ runs-on: ubuntu-24.04
+ services:
+ postgres:
+ image: postgres
+ ports:
+ - 5432:5432
+ env:
+ POSTGRES_USER: precontentieux
+ POSTGRES_DB: precontest
+ POSTGRES_HOST: postgres
+ POSTGRES_PASSWORD: precontentieux
+ POSTGRES_PORT: 5432
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+ mailpit:
+ image: axllent/mailpit
+ ports:
+ - 1025:1025
+ - 8025:8025
+ steps:
+ - uses: actions/checkout@v4
+ - uses: browser-actions/setup-firefox@v1
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18.x
+ - name: Cache composer dependencies
+ uses: actions/cache@v3
+ with:
+ path: vendor
+ key: composer-${{ hashFiles('composer.lock') }}
+
+ - name: Cache yarn dependencies
+ uses: actions/cache@v3
+ with:
+ path: node_modules
+ key: yarn-${{ hashFiles('yarn.lock') }}
+
+ - name: Setup PHP and run tests
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.2'
+ extensions: 'zip, intl, calendarn gd, pdo, pdo_pgsql, pgsql'
+
+ - name: Install yarn dependencies & build assets
+ run: |
+ sudo chown -R runner:runner .
+ composer install --no-interaction --optimize-autoloader
+ bin/console cache:clear
+ yarn install --no-progress --non-interactive
+ yarn build
+
+ - name: Run migration
+ run: bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing
+
+ - name: Detect headless browser driver
+ run: vendor/bin/bdi detect drivers
+
+ - name: Running unit test
+ run: |
+ env | grep MAILPIT
+ bin/phpunit --log-junit test-result.xml
+
+ - name: Check test result file exists
+ id: check_test_result_file
+ uses: andstor/file-existence-action@v1
+ with:
+ files: test-result.xml
+
+ - name: Publish Test Results
+ uses: EnricoMi/publish-unit-test-result-action@v2
+ if: ${{ steps.check_test_result_file.outputs.files_exists == 'true' }}
+ with:
+ files: |
+ test-result.xml
\ No newline at end of file
diff --git a/README.md b/README.md
index fd696f4..4262907 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# 🇫🇷 👩⚖️ 🤝 Précontentieux
+# 🇫🇷 👩⚖️ 🤝 Mon Indemnisation Justice (ex Précontentieux)
## Installation
diff --git a/bin/console b/bin/console
index 012b1e9..db6fd76 100755
--- a/bin/console
+++ b/bin/console
@@ -13,6 +13,8 @@ if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}
+umask(0002);
+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
$dotenv = new Dotenv();
diff --git a/compose.yaml b/compose.yaml
index 47f30b8..f279f9a 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -52,6 +52,7 @@ services:
- PANTHER_ERROR_SCREENSHOT_DIR=public/screenshots
- PANTHER_ERROR_SCREENSHOT_ATTACH=true
- PANTHER_FIREFOX_ARGUMENTS='-width=1200 -height=2000'
+ - MAILPIT_URL=http://mailpit:8025
restart: always
depends_on:
- postgres
diff --git a/composer.json b/composer.json
index 90ecda6..289a471 100644
--- a/composer.json
+++ b/composer.json
@@ -9,7 +9,6 @@
"ext-iconv": "*",
"acsiomatic/device-detector-bundle": "^0.5.0",
"api-platform/core": "^3.2",
- "clegginabox/pdf-merger": "dev-master",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3",
diff --git a/composer.lock b/composer.lock
index 11aa070..dc1e2d6 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "7334195fef75e952b38038c551a122d4",
+ "content-hash": "81f607ac39d53792508ac5e868d91adc",
"packages": [
{
"name": "acsiomatic/device-detector-bundle",
@@ -420,47 +420,6 @@
],
"time": "2024-10-09T08:09:09+00:00"
},
- {
- "name": "clegginabox/pdf-merger",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/clegginabox/pdf-merger.git",
- "reference": "998997f71bc0bc82c987707899f12d3d40421b24"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/clegginabox/pdf-merger/zipball/998997f71bc0bc82c987707899f12d3d40421b24",
- "reference": "998997f71bc0bc82c987707899f12d3d40421b24",
- "shasum": ""
- },
- "require": {
- "setasign/fpdf": "^1.8",
- "setasign/fpdi": "^2.2"
- },
- "default-branch": true,
- "type": "library",
- "autoload": {
- "classmap": [
- "src/PDFMerger/PDFMerger.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Paul Clegg",
- "email": "paul@clegginabox.co.uk"
- }
- ],
- "description": "PDF File Merger for PHP5",
- "support": {
- "source": "https://github.com/clegginabox/pdf-merger/tree/master"
- },
- "time": "2024-06-21T04:59:28+00:00"
- },
{
"name": "doctrine/cache",
"version": "2.2.0",
@@ -3893,124 +3852,6 @@
],
"time": "2024-07-29T11:22:56+00:00"
},
- {
- "name": "setasign/fpdf",
- "version": "1.8.6",
- "source": {
- "type": "git",
- "url": "https://github.com/Setasign/FPDF.git",
- "reference": "0838e0ee4925716fcbbc50ad9e1799b5edfae0a0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Setasign/FPDF/zipball/0838e0ee4925716fcbbc50ad9e1799b5edfae0a0",
- "reference": "0838e0ee4925716fcbbc50ad9e1799b5edfae0a0",
- "shasum": ""
- },
- "require": {
- "ext-gd": "*",
- "ext-zlib": "*"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "fpdf.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Olivier Plathey",
- "email": "oliver@fpdf.org",
- "homepage": "http://fpdf.org/"
- }
- ],
- "description": "FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.",
- "homepage": "http://www.fpdf.org",
- "keywords": [
- "fpdf",
- "pdf"
- ],
- "support": {
- "source": "https://github.com/Setasign/FPDF/tree/1.8.6"
- },
- "time": "2023-06-26T14:44:25+00:00"
- },
- {
- "name": "setasign/fpdi",
- "version": "v2.6.1",
- "source": {
- "type": "git",
- "url": "https://github.com/Setasign/FPDI.git",
- "reference": "09a816004fcee9ed3405bd164147e3fdbb79a56f"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Setasign/FPDI/zipball/09a816004fcee9ed3405bd164147e3fdbb79a56f",
- "reference": "09a816004fcee9ed3405bd164147e3fdbb79a56f",
- "shasum": ""
- },
- "require": {
- "ext-zlib": "*",
- "php": "^5.6 || ^7.0 || ^8.0"
- },
- "conflict": {
- "setasign/tfpdf": "<1.31"
- },
- "require-dev": {
- "phpunit/phpunit": "~5.7",
- "setasign/fpdf": "~1.8.6",
- "setasign/tfpdf": "~1.33",
- "squizlabs/php_codesniffer": "^3.5",
- "tecnickcom/tcpdf": "~6.2"
- },
- "suggest": {
- "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "setasign\\Fpdi\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jan Slabon",
- "email": "jan.slabon@setasign.com",
- "homepage": "https://www.setasign.com"
- },
- {
- "name": "Maximilian Kresse",
- "email": "maximilian.kresse@setasign.com",
- "homepage": "https://www.setasign.com"
- }
- ],
- "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
- "homepage": "https://www.setasign.com/fpdi",
- "keywords": [
- "fpdf",
- "fpdi",
- "pdf"
- ],
- "support": {
- "issues": "https://github.com/Setasign/FPDI/issues",
- "source": "https://github.com/Setasign/FPDI/tree/v2.6.1"
- },
- "funding": [
- {
- "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi",
- "type": "tidelift"
- }
- ],
- "time": "2024-09-02T10:17:15+00:00"
- },
{
"name": "symfony/apache-pack",
"version": "v1.0.1",
@@ -12914,9 +12755,7 @@
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {
- "clegginabox/pdf-merger": 20
- },
+ "stability-flags": {},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
@@ -12924,6 +12763,6 @@
"ext-ctype": "*",
"ext-iconv": "*"
},
- "platform-dev": [],
+ "platform-dev": {},
"plugin-api-version": "2.6.0"
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 896f9ed..ceea437 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -19,7 +19,6 @@
-
diff --git a/tests/Functional/Requerant/EligibiliteBrisPorteTest.php b/tests/Functional/Requerant/EligibiliteBrisPorteTest.php
index d004691..f0b944b 100644
--- a/tests/Functional/Requerant/EligibiliteBrisPorteTest.php
+++ b/tests/Functional/Requerant/EligibiliteBrisPorteTest.php
@@ -48,7 +48,7 @@ protected function setUp(): void
// Vider les boîtes courriel :
// Doc API mailpit https://mailpit.axllent.org/docs/api-v1/view.html#delete-/api/v1/messages
- $this->mailerClient = new HttpClient(['base_uri' => 'http://mailpit:8025']);
+ $this->mailerClient = new HttpClient(['base_uri' => $_ENV['MAILPIT_URL'] ?? $_SERVER['MAILPIT_URL']]);
$this->mailerClient->delete('/api/v1/messages');
}