Skip to content
Merged
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
16 changes: 13 additions & 3 deletions .github/workflows/composer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ on:
pull_request:
paths: &paths
- "composer.json"
- "composer.lock"
- "docker-compose.yml"
- "compose.yaml"
push:
branches:
- main
Expand Down Expand Up @@ -62,8 +61,17 @@ jobs:
run: |
docker network create frontend

- run: |
- &composer_install
name: Composer install
run: |
# Create a temporary composer file to install https://github.com/mglaman/composer-drupal-lenient before the real install needs it.
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer init --no-interaction
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer require mglaman/composer-drupal-lenient
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm rm composer.lenient.*
docker compose run --rm phpfpm composer install

- run: |
docker compose run --rm phpfpm composer normalize --dry-run

composer-audit:
Expand All @@ -75,5 +83,7 @@ jobs:
run: |
docker network create frontend

- *composer_install

- run: |
docker compose run --rm phpfpm composer audit
14 changes: 11 additions & 3 deletions .github/workflows/php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ on:
paths: &paths
- "**/*.php"
- "composer.json"
- "composer.lock"
- "docker-compose.yml"
- "compose.yaml"
push:
branches:
- main
Expand All @@ -60,6 +59,15 @@ jobs:
run: |
docker network create frontend

- run: |
- &composer_install
name: Composer install
run: |
# Create a temporary composer file to install https://github.com/mglaman/composer-drupal-lenient before the real install needs it.
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer init --no-interaction
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer require mglaman/composer-drupal-lenient
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm rm composer.lenient.*
docker compose run --rm phpfpm composer install

- run: |
docker compose run --rm phpfpm vendor/bin/phpcs
14 changes: 11 additions & 3 deletions .github/workflows/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ on:
paths: &paths
- "**/*.twig"
- "composer.json"
- "composer.lock"
- "docker-compose.yml"
- "compose.yaml"
push:
branches:
- main
Expand All @@ -50,6 +49,15 @@ jobs:
run: |
docker network create frontend

- run: |
- &composer_install
name: Composer install
run: |
# Create a temporary composer file to install https://github.com/mglaman/composer-drupal-lenient before the real install needs it.
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer init --no-interaction
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer require mglaman/composer-drupal-lenient
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm rm composer.lenient.*
docker compose run --rm phpfpm composer install

- run: |
docker compose run --rm phpfpm vendor/bin/twig-cs-fixer lint
8 changes: 2 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,8 @@ tasks:

test:
cmds:
- docker compose run --env PHP_XDEBUG_MODE --env PHP_XDEBUG_WITH_REQUEST
--env PHP_IDE_CONFIG --rm phpfpm vendor/bin/phpunit {{.CLI_ARGS}}
- docker compose run --env PHP_XDEBUG_MODE --env PHP_XDEBUG_WITH_REQUEST --env PHP_IDE_CONFIG --rm phpfpm vendor/bin/phpunit {{.CLI_ARGS}}

xdebug:test:
cmds:
- PHP_XDEBUG_MODE=debug PHP_XDEBUG_WITH_REQUEST=yes
PHP_IDE_CONFIG=serverName=localhost docker compose run --env
PHP_XDEBUG_MODE --env PHP_XDEBUG_WITH_REQUEST --env PHP_IDE_CONFIG --rm
phpfpm vendor/bin/phpunit {{.CLI_ARGS}}
- PHP_XDEBUG_MODE=debug PHP_XDEBUG_WITH_REQUEST=yes PHP_IDE_CONFIG=serverName=localhost docker compose run --env PHP_XDEBUG_MODE --env PHP_XDEBUG_WITH_REQUEST --env PHP_IDE_CONFIG --rm phpfpm vendor/bin/phpunit {{.CLI_ARGS}}
17 changes: 15 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,29 @@
"drupal/system_stream_wrapper": "^2.1",
"drush/drush": "^12 || ^13",
"itk-dev/serviceplatformen": "^1.9",
"os2forms/os2forms": "^5.0"
"os2forms/os2forms": "dev-feature/add-first-middle-and-last-name-nemid-elements as 5.1.0",
"os2web/os2web_datalookup": "dev-feature/fetch-first-middle-and-last-name as 3.1.0"
},
"require-dev": {
"drupal/coder": "^8.3",
"ergebnis/composer-normalize": "^2.50",
"mglaman/composer-drupal-lenient": "^1.0",
"mglaman/phpstan-drupal": "^2.0",
"phpstan/extension-installer": "^1.4",
"phpunit/phpunit": "^9.6",
"vincentlanglet/twig-cs-fixer": "^3.13"
},
"repositories": [
{
"name": "os2web/os2web_datalookup",
"type": "vcs",
"url": "https://github.com/itk-dev/os2web_datalookup"
},
{
"name": "os2forms/os2forms",
"type": "vcs",
"url": "https://github.com/itk-dev/os2forms"
},
{
"type": "composer",
"url": "https://packages.drupal.org/8"
Expand All @@ -45,12 +57,13 @@
"allow-plugins": {
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/core-composer-scaffold": false,
"ergebnis/composer-normalize": true,
"mglaman/composer-drupal-lenient": true,
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": false,
"simplesamlphp/composer-xmlprovider-installer": false,
"zaporylie/composer-drupal-optimizations": true
"zaporylie/composer-drupal-optimizations": false
}
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion src/Drush/Commands/ValidateXmlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Drupal\os2forms_fordelingskomponent\Drush\Commands;

use Composer\Console\Input\InputOption;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Url;
use Drupal\os2forms_fordelingskomponent\Helper\FordelingskomponentHelper;
Expand All @@ -18,6 +17,7 @@
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

Expand Down
2 changes: 1 addition & 1 deletion src/Helper/FordelingskomponentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public function checkFilesDelivered(
}
catch (\Exception $exception) {
$this->logger->warning('Error checking file %filename: %message', $context + [
'%filename' => $filename ?? NULL,
'%filename' => $filename,
'%message' => $exception->getMessage(),
'exception' => $exception,
]);
Expand Down
8 changes: 7 additions & 1 deletion src/Helper/WebformHelperSF2900.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ public function renderPreview(WebformHandlerSF2900 $handler, WebformSubmissionIn
$distributionObject = NULL;
$xml = new XmlRenderResult(
template: '',
context: [],
context: [
'submission' => [],
'files' => [],
'handler' => [
'settings' => [],
],
],
rendered: NULL,
exception: NULL,
);
Expand Down
10 changes: 9 additions & 1 deletion src/Helper/XmlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,16 @@ public function render(string $template, array $context, bool $validateXml = TRU

/**
* Get render context.
*
* @return array {
* submission: array,
* files: array,
* handler: array{
* settings: array
* }
* }
*/
public function getRenderContext(HandlerSettings $handlerSettings, WebformSubmissionInterface $submission, array $files) {
public function getRenderContext(HandlerSettings $handlerSettings, WebformSubmissionInterface $submission, array $files): array {
return [
'submission' => $submission->toArray(TRUE),
'files' => $files,
Expand Down
6 changes: 4 additions & 2 deletions src/Model/XmlRenderResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ public function __construct(
* The context.
*
* @var array{
* submission: array,
* submission: array|WebformSubmissionInterface|null,
* files: array,
* handler: array,
* handler: array{
* settings: array,
* },
* }
*/
public array $context,
Expand Down
1 change: 1 addition & 0 deletions src/Os2formsFordelingskomponentTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ final class Os2formsFordelingskomponentTwigExtension extends AbstractExtension {
/**
* {@inheritdoc}
*/
#[\Override]
public function getFunctions(): array {
$functions[] = new TwigFunction(
'os2forms_fordelingskomponent_intval',
Expand Down
Loading