Skip to content

Commit

Permalink
Support Sylius 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandoorn committed Dec 18, 2024
1 parent b8dfe61 commit f1653cd
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 132 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2", "8.3"]
symfony: ["^5.4", "^6.4"]
sylius: ["~1.13.0", "~1.14.0"]
php: ["8.2", "8.3"]
symfony: ["^6.4"]
sylius: ["~2.0.0"]
node: ["14.x"]
mysql: ["8.0"]

env:
APP_ENV: test
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down
35 changes: 17 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@
"sylius-plugin"
],
"license": "MIT",
"conflict": {
"twig/twig": "<2.9"
},
"require": {
"php": "^7.4 || ^8.1",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0 || ~1.12.0 || ~1.13.0 || ~1.14.0"
"php": "^8.2",
"sylius/sylius": "~2.0.0"
},
"require-dev": {
"api-platform/core": "~2.5.0 || ~2.6.0 || ~2.7.0",
"api-platform/core": "^2.7.0",
"lchrusciel/api-test-case": "^5.1",
"league/flysystem-bundle": "^2.0 || ^3.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
"nyholm/psr7": "^1.8",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.2",
Expand All @@ -29,15 +26,16 @@
"phpunit/phpunit": "^9.5",
"sylius-labs/coding-standard": "^4.0",
"sylius/calendar": "^0.5.0",
"sylius/state-machine-abstraction": "^1.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.4",
"symfony/debug-bundle": "^4.4 || ^5.4 || ^6.4",
"symfony/dotenv": "^4.4 || ^5.4 || ^6.4",
"symfony/intl": "^4.4 || ^5.4 || ^6.4",
"symfony/runtime": "^4.4 || ^5.4 || ^6.4 || ^7.0",
"symfony/web-profiler-bundle": "^4.4 || ^5.4 || ^6.4",
"symfony/webpack-encore-bundle": "^1.15",
"vimeo/psalm": "4.23.0"
"sylius/twig-hooks": "^0.5.1",
"symfony/browser-kit": "^6.4",
"symfony/debug-bundle": "^6.4",
"symfony/dotenv": "^6.4",
"symfony/intl": "^6.4",
"symfony/runtime": "^6.4 || ^7.0",
"symfony/ux-icons": "^2.22",
"symfony/web-profiler-bundle": "^6.4",
"symfony/webpack-encore-bundle": "^1.15 || ^2.2",
"vimeo/psalm": "^4.0"
},
"config": {
"sort-packages": true,
Expand All @@ -46,12 +44,13 @@
"dealerdirect/phpcodesniffer-composer-installer": true,
"symfony/thanks": true,
"phpstan/extension-installer": true,
"symfony/runtime": true
"symfony/runtime": true,
"php-http/discovery": true
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
Expand Down
32 changes: 19 additions & 13 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return [
$bundles = [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Expand Down Expand Up @@ -28,11 +28,6 @@
Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true],
Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true],
Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true],
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Expand All @@ -44,17 +39,28 @@
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
SitemapPlugin\SitemapPlugin::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
Sylius\TwigExtra\Symfony\SyliusTwigExtraBundle::class => ['all' => true],
Sylius\TwigHooks\SyliusTwigHooksBundle::class => ['all' => true],
Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true],
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true],
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
];
SitemapPlugin\SitemapPlugin::class => ['all' => true],
];

if (class_exists(winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class)) {
$bundles[winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class] = ['all' => true];
}

return $bundles;
7 changes: 2 additions & 5 deletions tests/Application/config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusPayumBundle/Resources/config/app/config.yaml" }
- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" }

- { resource: "@SitemapPlugin/Resources/config/config.yaml" }
- { resource: "@SyliusPayumBundle/Resources/config/app/config.yaml" }

parameters:
sylius_core.public_dir: '%kernel.project_dir%/public'
Expand Down
11 changes: 0 additions & 11 deletions tests/Application/config/packages/fos_rest.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions tests/Application/config/packages/http_discovery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory'

http_discovery.psr17_factory:
class: Http\Discovery\Psr17Factory
1 change: 0 additions & 1 deletion tests/Application/config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ parameters:
sylius.security.shop_regex: "^/(?!admin|new-api|api/.*|api$|media/.*)[^/]++"

security:
enable_authenticator_manager: true
providers:
sylius_shop_user_provider:
id: sylius.shop_user_provider.email_or_name_based
Expand Down
6 changes: 0 additions & 6 deletions tests/Application/config/sylius/1.8/bundles.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions tests/Application/config/sylius/1.8/routes/dev/twig.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions tests/Application/config/sylius/1.9/bundles.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/Application/config/symfony/4.4/packages/framework.yaml

This file was deleted.

26 changes: 6 additions & 20 deletions tests/Controller/XmlApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,13 @@ protected function generateSitemaps(): void

protected function getResponse(string $uri): Response
{
if (\version_compare(Kernel::VERSION, '6.0', '>=')) {
$this->doRequest($uri);

return new Response(
$this->client->getInternalResponse()->getContent(),
$this->client->getInternalResponse()->getStatusCode(),
$this->client->getInternalResponse()->getHeaders(),
);
}

\ob_start();
$this->doRequest($uri);
$response = $this->client->getResponse();
$contents = \ob_get_clean();
$this->client->request('GET', $uri);

return new Response($contents, $response->getStatusCode(), $response->headers->all());
return new Response(
$this->client->getInternalResponse()->getContent(),
$this->client->getInternalResponse()->getStatusCode(),
$this->client->getInternalResponse()->getHeaders(),
);
}

protected function deleteSitemaps(): void
Expand All @@ -74,9 +65,4 @@ protected function deleteSitemaps(): void
}
}
}

private function doRequest(string $uri): void
{
$this->client->request('GET', $uri);
}
}

0 comments on commit f1653cd

Please sign in to comment.