Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.4-fpm-alpine
FROM php:8.5-fpm-alpine

ARG UID
ARG GID
Expand All @@ -13,8 +13,7 @@ RUN apk update && apk add \
bash \
icu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl opcache \
&& docker-php-ext-enable opcache
&& docker-php-ext-install intl

RUN ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime \
&& sed -i "s/^;date.timezone =.*/date.timezone = Europe\/Paris/" $PHP_INI_DIR/php.ini
Expand Down
44 changes: 32 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ jobs:
- '8.2'
- '8.3'
- '8.4'
dependencies: [highest]
- '8.5'
dependencies: [highest, lowest]
allowed-to-fail: [false]
symfony-require: ['']
variant: [normal]
include:
- php-version: '8.1'
dependencies: highest
- php-version: '8.2'
dependencies: lowest
allowed-to-fail: false
symfony-require: 6.4.*
variant: symfony/symfony:"6.4.*"
Expand All @@ -41,8 +42,8 @@ jobs:
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"
symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
Expand All @@ -51,8 +52,8 @@ jobs:
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"
symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
Expand All @@ -61,12 +62,31 @@ jobs:
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"

symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
symfony-require: 8.*
variant: symfony/symfony:"8.*"
- php-version: '8.5'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.4.*
variant: symfony/symfony:"6.4.*"
- php-version: '8.5'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.5'
dependencies: highest
allowed-to-fail: false
symfony-require: 8.*
variant: symfony/symfony:"8.*"
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
Expand All @@ -87,4 +107,4 @@ jobs:
#- name: Send coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# files: build/logs/clover.xml
# files: build/logs/clover.xml
5 changes: 2 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

return (new PhpCsFixer\Config())
->setRules([
'@PHP71Migration' => true,
'@PHP82Migration' => true,
'@PHPUnit75Migration:risky' => true,
'@PHP8x2Migration' => true,
'@PHPUnit7x5Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@DoctrineAnnotation' => true,
Expand Down
48 changes: 24 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"name": "Xavier Marchegay",
"email": "xmarchegay@clever-age.com",
"role": "Developer"
"role": "Lead Developer"
}
],
"autoload": {
Expand All @@ -36,41 +36,41 @@
}
},
"require": {
"php": ">=8.1",
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"cleverage/process-bundle": "^4.0",
"doctrine/common": "^3.0",
"doctrine/dbal": "^2.9 || ^3.0",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.9 || ^3.0",
"dragonmantank/cron-expression": "^3.4",
"easycorp/easyadmin-bundle": "^4.8",
"symfony/doctrine-messenger": "^6.4|^7.3",
"symfony/dotenv": "^6.4|^7.3",
"symfony/messenger": "^6.4|^7.3",
"symfony/runtime": "^6.4|^7.3",
"symfony/scheduler": "^6.4|^7.3",
"symfony/string": "^6.4|^7.3",
"symfony/uid": "^6.4|^7.3"
"cleverage/process-bundle": "^5.0",
"doctrine/common": "^3.5",
"doctrine/dbal": "^3.10 || ^4.4",
"doctrine/doctrine-bundle": "^2.18 || ^3.1",
"doctrine/doctrine-migrations-bundle": "^3.7 || ^4",
"doctrine/orm": "^2.20 || ^3.5",
"dragonmantank/cron-expression": "^3.6",
"easycorp/easyadmin-bundle": "^4.27",
"symfony/doctrine-messenger": "^6.4 || ^7.4 || ^8",
"symfony/dotenv": "^6.4 || ^7.4 || ^8",
"symfony/messenger":"^6.4 || ^7.4 || ^8",
"symfony/runtime": "^6.4 || ^7.4 || ^8",
"symfony/scheduler": "^6.4 || ^7.4 || ^8",
"symfony/string":"^6.4 || ^7.4 || ^8",
"symfony/uid": "^6.4 || ^7.4 || ^8"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4",
"doctrine/doctrine-fixtures-bundle": "^3 || ^4",
"friendsofphp/php-cs-fixer": "*",
"phpstan/extension-installer": "*",
"phpstan/phpstan": "*",
"phpstan/phpstan-doctrine": "*",
"phpstan/phpstan-symfony": "*",
"phpunit/phpunit": "<10.0",
"phpunit/phpunit": "*",
"rector/rector": "*",
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "^6.4|^7.3",
"symfony/css-selector": "^6.4|^7.3",
"symfony/debug-bundle": "^6.4|^7.3",
"symfony/browser-kit": "^6.4 || ^7.4 || ^8",
"symfony/css-selector": "^6.4 || ^7.4 || ^8",
"symfony/debug-bundle": "^6.4 || ^7.4 || ^8",
"symfony/maker-bundle": "^1.31",
"symfony/web-profiler-bundle": "^6.4|^7.3",
"vincentlanglet/twig-cs-fixer": "^3.3"
"symfony/web-profiler-bundle": "^6.4 || ^7.4 || ^8",
"vincentlanglet/twig-cs-fixer": "^3.11"
},
"conflict": {
"symfony/twig-bridge": "7.2.0",
Expand Down
3 changes: 3 additions & 0 deletions config/routes/easyadmin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
easyadmin:
resource: .
type: easyadmin.routes
21 changes: 8 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
failOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
</source>
</phpunit>
6 changes: 3 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
use Rector\ValueObject\PhpVersion;

return RectorConfig::configure()
->withPhpVersion(PhpVersion::PHP_84)
->withPhpVersion(PhpVersion::PHP_85)
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withPhpSets(php81: true)
->withPhpSets(php82: true)
// here we can define, what prepared sets of rules will be applied
->withComposerBased(doctrine: true)
->withPreparedSets(deadCode: true, codeQuality: true, doctrineCodeQuality: true, symfonyCodeQuality: true)
->withAttributesSets(symfony: true, doctrine: true)
->withSets([
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_82,
SymfonySetList::SYMFONY_64,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
Expand Down
15 changes: 6 additions & 9 deletions src/Controller/Admin/Process/LaunchAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,18 @@
#[IsGranted('ROLE_USER')]
class LaunchAction extends AbstractController
{
public function __construct(private readonly MessageBusInterface $messageBus)
public function __construct(private readonly MessageBusInterface $messageBus, private readonly RequestStack $requestStack, private readonly ProcessConfigurationsManager $processConfigurationsManager, private readonly AdminContext $context)
{
}

public function __invoke(
RequestStack $requestStack,
string $uploadDirectory,
ProcessConfigurationsManager $processConfigurationsManager,
AdminContext $context,
): Response {
$processCode = $requestStack->getMainRequest()?->get('process');
if (null === $processCode) {
$processCode = (string) $this->requestStack->getMainRequest()?->request->get('process');
if ('' === $processCode) {
throw new MissingProcessException();
}
$uiOptions = $processConfigurationsManager->getUiOptions($processCode);
$uiOptions = $this->processConfigurationsManager->getUiOptions($processCode);
if (null === $uiOptions) {
throw new \InvalidArgumentException('Missing UI Options');
}
Expand Down Expand Up @@ -84,7 +81,7 @@ public function __invoke(
}
$form->setData($default);
}
$form->handleRequest($requestStack->getMainRequest());
$form->handleRequest($this->requestStack->getMainRequest());
if ($form->isSubmitted() && $form->isValid()) {
$input = $form->get('input')->getData();
if ($input instanceof UploadedFile) {
Expand All @@ -104,7 +101,7 @@ public function __invoke(

return $this->redirectToRoute('process', ['routeName' => 'process_list']);
}
$context->getAssets()->addJsAsset(Asset::fromEasyAdminAssetPackage('field-collection.js')->getAsDto());
$this->context->getAssets()->addJsAsset(Asset::fromEasyAdminAssetPackage('field-collection.js')->getAsDto());

return $this->render(
'@CleverAgeUiProcess/admin/process/launch.html.twig',
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/Admin/Process/ListAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
#[IsGranted('ROLE_USER')]
class ListAction extends AbstractController
{
public function __construct(private readonly IntlFormatterInterface $intlFormatter)
public function __construct(private readonly IntlFormatterInterface $intlFormatter, private readonly ProcessConfigurationsManager $processConfigurationsManager)
{
}

public function __invoke(ProcessConfigurationsManager $processConfigurationsManager): Response
public function __invoke(): Response
{
return $this->render(
'@CleverAgeUiProcess/admin/process/list.html.twig',
[
'processes' => $processConfigurationsManager->getPublicProcesses(),
'processes' => $this->processConfigurationsManager->getPublicProcesses(),
'IntlFormatterService' => $this->intlFormatter,
]
);
Expand Down
12 changes: 7 additions & 5 deletions src/Controller/Admin/Process/UploadAndExecuteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
#[IsGranted('ROLE_USER')]
class UploadAndExecuteAction extends AbstractController
{
public function __construct(private readonly RequestStack $requestStack, private readonly MessageBusInterface $messageBus)
{
}

public function __invoke(
RequestStack $requestStack,
MessageBusInterface $messageBus,
string $uploadDirectory,
#[ValueResolver('process')] ProcessConfiguration $processConfiguration,
): Response {
Expand All @@ -49,15 +51,15 @@ public function __invoke(
$form = $this->createForm(
ProcessUploadFileType::class,
null,
['process_code' => $requestStack->getMainRequest()?->get('process')]
['process_code' => $this->requestStack->getMainRequest()?->request->get('process')]
);
$form->handleRequest($requestStack->getMainRequest());
$form->handleRequest($this->requestStack->getMainRequest());
if ($form->isSubmitted() && $form->isValid()) {
/** @var UploadedFile $file */
$file = $form->getData();
$savedFilepath = \sprintf('%s/%s.%s', $uploadDirectory, Uuid::v4(), $file->getClientOriginalExtension());
(new Filesystem())->dumpFile($savedFilepath, $file->getContent());
$messageBus->dispatch(
$this->messageBus->dispatch(
new ProcessExecuteMessage(
$form->getConfig()->getOption('process_code'),
$savedFilepath
Expand Down
10 changes: 5 additions & 5 deletions src/Controller/Admin/ProcessExecutionCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function __construct(
private readonly ProcessExecutionRepository $processExecutionRepository,
private readonly string $logDirectory,
private readonly TranslatorInterface $translator,
private readonly AdminContext $context,
) {
}

Expand Down Expand Up @@ -109,7 +110,7 @@ public function configureActions(Actions $actions): Actions
);
}

public function showLogs(AdminContext $adminContext): RedirectResponse
public function showLogs(): RedirectResponse
{
/** @var AdminUrlGenerator $adminUrlGenerator */
$adminUrlGenerator = $this->container->get(AdminUrlGenerator::class);
Expand All @@ -133,11 +134,10 @@ public function showLogs(AdminContext $adminContext): RedirectResponse
return $this->redirect($url);
}

public function downloadLogFile(
AdminContext $context,
): Response {
public function downloadLogFile(): Response
{
/** @var ProcessExecution $processExecution */
$processExecution = $context->getEntity()->getInstance();
$processExecution = $this->context->getEntity()->getInstance();
$filepath = $this->getLogFilePath($processExecution);
$basename = basename($filepath);
$content = file_get_contents($filepath);
Expand Down
8 changes: 6 additions & 2 deletions src/Controller/Admin/Security/LogoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@

class LogoutController extends AbstractController
{
public function __construct(private readonly Security $security)
{
}

#[Route('/process/logout', name: 'process_logout')]
public function __invoke(Security $security): Response
public function __invoke(): Response
{
$security->logout();
$this->security->logout();

return $this->redirectToRoute('process_login');
}
Expand Down
Loading
Loading