Skip to content
Open
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
12 changes: 6 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
continue-on-error: true

- name: "Lint yaml files"
run: "(cd tests/Application && bin/console lint:yaml ../../src/Resources)"
run: "vendor/bin/console lint:yaml src/Resources"

- name: "Lint twig files"
run: "(cd tests/Application && bin/console lint:twig ../../src/Resources)"
run: "vendor/bin/console lint:twig src/Resources"

dependency-analysis:
name: "Dependency Analysis (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})"
Expand Down Expand Up @@ -238,16 +238,16 @@ jobs:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Lint container"
run: "(cd tests/Application && bin/console lint:container)"
run: "vendor/bin/console lint:container"

- name: "Create database"
run: "(cd tests/Application && bin/console doctrine:database:create)"
run: "vendor/bin/console doctrine:database:create"

- name: "Create database schema"
run: "(cd tests/Application && bin/console doctrine:schema:create)"
run: "vendor/bin/console doctrine:schema:create"

- name: "Validate Doctrine mapping"
run: "(cd tests/Application && bin/console doctrine:schema:validate)"
run: "vendor/bin/console doctrine:schema:validate"

mutation-tests:
name: "Mutation tests"
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/.build/
/var/
/vendor/
/node_modules/
/composer.lock

/tests/Application/yarn.lock
/tests/TestApplication/.env.local
/tests/TestApplication/.env.*.local

/.phpunit.result.cache

Expand Down
File renamed without changes.
23 changes: 11 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
"doctrine/orm": "^2.7",
"fakerphp/faker": "^1.23",
"knplabs/knp-menu": "^3.1",
"sylius/channel": "^1.0",
"sylius/channel-bundle": "^1.0",
"sylius/core": "^1.0",
"sylius/core-bundle": "^1.0",
"sylius/locale": "^1.0",
"sylius/resource-bundle": "^1.6",
"sylius/ui-bundle": "^1.0",
"symfony/config": "^5.4 || ^6.4 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0",
Expand Down Expand Up @@ -49,7 +44,8 @@
"phpunit/phpunit": "^9.6",
"psalm/plugin-phpunit": "^0.18",
"setono/code-quality-pack": "^2.7",
"sylius/sylius": "~1.12.13",
"sylius/sylius": "^1.14",
"sylius/test-application": "^1.14.0@alpha",
"symfony/debug-bundle": "^5.4 || ^6.4 || ^7.0",
"symfony/dotenv": "^5.4 || ^6.4 || ^7.0",
"symfony/intl": "^5.4 || ^6.4 || ^7.0",
Expand All @@ -67,18 +63,18 @@
},
"autoload-dev": {
"psr-4": {
"Setono\\SyliusTermsPlugin\\Tests\\": "tests/"
},
"classmap": [
"tests/Application/Kernel.php"
]
"Setono\\SyliusTermsPlugin\\Tests\\": "tests/",
"Tests\\Setono\\SyliusTermsPlugin\\": "tests/TestApplication/src"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"ergebnis/composer-normalize": true,
"infection/extension-installer": true,
"symfony/thanks": false
"symfony/thanks": false,
"symfony/runtime": true,
"symfony/flex": true
},
"sort-packages": true
},
Expand All @@ -87,5 +83,8 @@
"check-style": "ecs check",
"fix-style": "ecs check --fix",
"phpunit": "phpunit"
},
"extra": {
"public-dir": "vendor/sylius/test-application/public"
}
}
2 changes: 1 addition & 1 deletion node_modules
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" colors="true"
bootstrap="tests/Application/config/bootstrap.php">
bootstrap="vendor/sylius/test-application/config/bootstrap.php">
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
Expand All @@ -13,6 +13,7 @@
</testsuite>
</testsuites>
<php>
<env name="KERNEL_CLASS" value="Sylius\TestApplication\Kernel" />
<env name="APP_ENV" value="test"/>
<env name="SHELL_VERBOSITY" value="-1"/>
</php>
Expand Down
12 changes: 11 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<directory name="src"/>
<directory name="tests"/>
<ignoreFiles>
<directory name="tests/Application"/>
<directory name="tests/TestApplication"/>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
Expand All @@ -30,6 +30,11 @@
</forbiddenFunctions>
<issueHandlers>
<MissingTemplateParam errorLevel="suppress"/> <!-- At some point we will add template params, but it's difficult when supporting multiple versions of Sylius/SF/Doctrine etc -->
<InvalidArgument>
<errorLevel type="suppress">
<directory name="src/Fixture"/>
</errorLevel>
</InvalidArgument>
<MixedAssignment>
<errorLevel type="suppress">
<directory name="src/Fixture"/>
Expand All @@ -40,5 +45,10 @@
<directory name="src/Fixture"/>
</errorLevel>
</MixedArgument>
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<directory name="src/Model"/>
</errorLevel>
</PropertyNotSetInConstructor>
</issueHandlers>
</psalm>
33 changes: 20 additions & 13 deletions src/DependencyInjection/SetonoSyliusTermsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ReflectionClass;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
Expand All @@ -16,14 +17,20 @@
final class SetonoSyliusTermsExtension extends AbstractResourceExtension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

$loader->load('services.xml');
}

public function prepend(ContainerBuilder $container): void
{
/**
* @psalm-suppress PossiblyNullArgument
*
* @var array{forms: array<class-string, array{label: string|null}>, routing: array{terms: string}, resources: array} $config
*/
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$config = $this->getCurrentConfiguration($container);

foreach ($config['forms'] as $form => $formConfig) {
$reflectionClass = new ReflectionClass($form);
Expand All @@ -34,18 +41,8 @@ public function load(array $configs, ContainerBuilder $container): void
$container->setParameter('setono_sylius_terms.forms', $config['forms']);
$container->setParameter('setono_sylius_terms.terms_path', $config['routing']['terms']);

$loader->load('services.xml');
$this->registerResources('setono_sylius_terms', SyliusResourceBundle::DRIVER_DOCTRINE_ORM, $config['resources'], $container);

$this->registerResources(
'setono_sylius_terms',
SyliusResourceBundle::DRIVER_DOCTRINE_ORM,
$config['resources'],
$container,
);
}

public function prepend(ContainerBuilder $container): void
{
$container->prependExtensionConfig('sylius_grid', [
'grids' => [
'setono_sylius_terms_terms' => [
Expand Down Expand Up @@ -103,4 +100,14 @@ public function prepend(ContainerBuilder $container): void
],
]);
}

/** @return array<array-key, mixed> */
private function getCurrentConfiguration(ContainerBuilder $container): array
{
/** @var ConfigurationInterface $configuration */
$configuration = $this->getConfiguration([], $container);
$configs = $container->getExtensionConfig($this->getAlias());

return $this->processConfiguration($configuration, $configs);
}
}
2 changes: 2 additions & 0 deletions src/Resources/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "app/fixtures.yaml" }
47 changes: 0 additions & 47 deletions tests/Application/.env

This file was deleted.

2 changes: 0 additions & 2 deletions tests/Application/.env.test

This file was deleted.

20 changes: 0 additions & 20 deletions tests/Application/.eslintrc.js

This file was deleted.

23 changes: 0 additions & 23 deletions tests/Application/.gitignore

This file was deleted.

73 changes: 0 additions & 73 deletions tests/Application/Kernel.php

This file was deleted.

1 change: 0 additions & 1 deletion tests/Application/assets/admin/entry.js

This file was deleted.

Loading
Loading