Skip to content

Commit

Permalink
[Maintenance] Support stable Sylius v1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Feb 16, 2022
1 parent e6b5057 commit 1ea12d4
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
php: ["8.0"]
symfony: ["^4.4", "^5.4"]
sylius: ["~1.10.0"]
sylius: ["~1.10.0", "~1.11.0"]
node: ["14.x"]
mysql: ["5.7", "8.0"]

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"phpstan/phpstan": "0.12.96",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "~4.0.0",
"symfony/browser-kit": "^4.4 || ^5.4",
"symfony/debug-bundle": "^4.4 || ^5.4",
Expand Down
7 changes: 7 additions & 0 deletions tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=66d45daf91b2ed1031e62d81c81dba2e
###< lexik/jwt-authentication-bundle ###

###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
MESSENGER_TRANSPORT_DSN=doctrine://default
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
###< symfony/messenger ###
5 changes: 5 additions & 0 deletions tests/Application/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ KERNEL_CLASS='Tests\Sylius\RefundPlugin\Application\Kernel'
###> knplabs/knp-snappy-bundle ###
WKHTMLTOPDF_PATH="%kernel.project_dir%/etc/wkhtmltopdf"
###< knplabs/knp-snappy-bundle ###

###> symfony/messenger ###
# Sync transport turned for testing env for the ease of testing
MESSENGER_TRANSPORT_DSN=sync://
###< symfony/messenger ###
10 changes: 9 additions & 1 deletion tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function configureRoutes(RouteCollectionBuilder $routes): void

protected function getContainerBaseClass(): string
{
if ($this->isTestEnvironment()) {
if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) {
return MockerContainer::class;
}

Expand Down Expand Up @@ -101,6 +101,14 @@ private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string
private function registerBundlesFromFile(string $bundlesFile): iterable
{
$contents = require $bundlesFile;

if (SyliusKernel::MINOR_VERSION > 10) {
$contents = array_merge(
['Sylius\Calendar\SyliusCalendarBundle' => ['all' => true]],
$contents
);
}

foreach ($contents as $class => $envs) {
if (isset($envs['all']) || isset($envs[$this->environment])) {
yield new $class();
Expand Down
Empty file.

0 comments on commit 1ea12d4

Please sign in to comment.