Skip to content

Commit

Permalink
feature #726 [Maintenance] Support PHP 8.1, drop PHP 7.4, bump to Syl…
Browse files Browse the repository at this point in the history
…ius 1.10 (Rafikooo)

This PR was merged into the 1.0-dev branch.

Discussion
----------

Support to PHP 8.1, drop support to PHP 7.4, bump to Sylius 1.10

Commits
-------

2111081 [Maintenance] Support PHP 8.1, drop PHP 7.4, bump to Sylius 1.10
  • Loading branch information
GSadee authored Apr 14, 2022
2 parents 01ccd6b + 2111081 commit fbe51f3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4, 8.0]
php: [8.0, 8.1]
node: [10.x]
mysql: [5.7, 8.0]
symfony: [^4.4, ~5.2.0, ~5.3.0]
sylius: [~1.9.0, ~1.10.0]
exclude:
- # Sylius 1.9 does not support PHP 8.0
sylius: ~1.9.0
php: 8.0
sylius: [~1.10.0, ~1.11.0]

env:
APP_ENV: test
APP_SECRET: "Dead men tell no tales"
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
MESSENGER_TRANSPORT_DSN: "sync://"

steps:
-
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Shop API for Sylius E-Commerce.",
"license": "MIT",
"require": {
"php": "^7.4|^8.0",
"sylius/sylius": "^1.9",
"php": "^8.0",
"sylius/sylius": "^1.10",
"lexik/jwt-authentication-bundle": "^2.5",
"symfony/messenger": "^4.4|^5.2",
"doctrine/doctrine-bundle": "^2.0"
Expand All @@ -15,8 +15,8 @@
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "0.12.90",
"phpstan/phpstan-webmozart-assert": "^0.12",
"phpstan/phpstan": "0.12.96",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.0",
"sylius-labs/coding-standard": "^3.0",
"symfony/debug-bundle": "^4.4|^5.2",
Expand Down
12 changes: 6 additions & 6 deletions spec/Validator/Cart/CartEligibilityValidatorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function it_add_no_violation_if_cart_has_eligible_item(
$arrayIterator->valid()->will(new ReturnPromise(array_merge(array_fill(0, count([$orderItem]), true), [false])));
$arrayIterator->current()->will(new ReturnPromise([$orderItem]));
$arrayIterator->count()->willReturn(count([$orderItem]));
$arrayIterator->next()->willReturn();
$arrayIterator->rewind()->willReturn();
$arrayIterator->next()->shouldBeCalled();
$arrayIterator->rewind()->shouldBeCalled();
$arrayIterator->key()->willReturn(0);

$order->getItems()->willReturn($collection);
Expand Down Expand Up @@ -84,8 +84,8 @@ function it_add_violation_if_cart_has_non_eligible_item_variant(
$arrayIterator->valid()->will(new ReturnPromise(array_merge(array_fill(0, count([$orderItem]), true), [false])));
$arrayIterator->current()->will(new ReturnPromise([$orderItem]));
$arrayIterator->count()->willReturn(count([$orderItem]));
$arrayIterator->next()->willReturn();
$arrayIterator->rewind()->willReturn();
$arrayIterator->next()->shouldNotBeCalled();
$arrayIterator->rewind()->shouldBeCalled();
$arrayIterator->key()->willReturn(0);

$order->getItems()->willReturn($collection);
Expand Down Expand Up @@ -121,8 +121,8 @@ function it_add_violation_if_cart_has_non_eligible_item(
$arrayIterator->valid()->will(new ReturnPromise(array_merge(array_fill(0, count([$orderItem]), true), [false])));
$arrayIterator->current()->will(new ReturnPromise([$orderItem]));
$arrayIterator->count()->willReturn(count([$orderItem]));
$arrayIterator->next()->willReturn();
$arrayIterator->rewind()->willReturn();
$arrayIterator->next()->shouldNotBeCalled();
$arrayIterator->rewind()->shouldBeCalled();
$arrayIterator->key()->willReturn(0);

$order->getItems()->willReturn($collection);
Expand Down
11 changes: 10 additions & 1 deletion tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Tests\Sylius\ShopApiPlugin\Application;

use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\LoaderInterface;
Expand Down Expand Up @@ -43,6 +44,14 @@ public function getLogDir(): string
public function registerBundles(): iterable
{
$contents = require $this->getProjectDir() . '/config/bundles.php';

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 Expand Up @@ -73,7 +82,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

0 comments on commit fbe51f3

Please sign in to comment.