Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional version php8 #62

Closed
Closed
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

/tests/Application/yarn.lock

/.php_cs.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
2 changes: 1 addition & 1 deletion .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'tests/Application/bin/console',
]);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
Expand Down
34 changes: 22 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,33 @@
"description": "Click and Collect plugin for Sylius, to sell and deliver securely during the COVID-19 pandemic.",
"license": "AGPL-3.0-or-later",
"require": {
"php": "^7.4",
"php": ">=7.4",
"simshaun/recurr": "^4.0",
"sylius/calendar": "^0.3.0",
"sylius/sylius": "^1.7",
"symfony/lock": "^4.4 || ^5.0"
JulieNobody marked this conversation as resolved.
Show resolved Hide resolved
},
"require-dev": {
"dbrekelmans/bdi": "^1.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.0",
"phpstan/phpstan-doctrine": "^0.12.0",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "^0.12.0",
"phpunit/phpunit": "^8.0",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^3.1",
"symfony/browser-kit": "^4.4",
"symfony/debug-bundle": "^4.4",
"symfony/dotenv": "^4.4",
"symfony/intl": "^4.4",
"symfony/panther": "^0.7.1",
"symfony/web-profiler-bundle": "^4.4",
"symfony/web-server-bundle": "^4.4"
"phpunit/phpunit": "^9.0",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.0",
"symfony/debug": "^4.4",
"symfony/debug-bundle": "^4.4 || ^5.0",
"symfony/dotenv": "^4.4 || ^5.0",
"symfony/intl": "^4.4 || ^5.0",
"symfony/panther": "^1.0",
"symfony/web-profiler-bundle": "^4.4 || ^5.0",
"symfony/web-server-bundle": "^4.4 || ^5.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
Expand All @@ -38,7 +43,12 @@
"classmap": ["tests/Application/Kernel.php"]
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"symfony/thanks": true
}
},
"conflict": {
"doctrine/inflector": "^1.4"
Expand Down
Binary file added drivers/chromedriver
Binary file not shown.
Binary file added drivers/geckodriver
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Entity/ClickNCollectShipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function setLocation(?LocationInterface $location): void

public function getCollectionTime(): ?\DateTimeInterface
{
return $this->collectionTime;
return $this->collectionTime;
}

public function setCollectionTime(?\DateTimeInterface $collectionTime): void
Expand Down
1 change: 0 additions & 1 deletion src/Entity/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Location implements LocationInterface
use TimestampableTrait;
use ToggleableTrait;

/** @var mixed */
protected $id;
protected ?string $code = null;
protected string $name = '';
Expand Down
1 change: 0 additions & 1 deletion src/Validator/Constraints/SlotAvailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace CoopTilleuls\SyliusClickNCollectPlugin\Validator\Constraints;

use Symfony\Component\Validator\Constraint;
use CoopTilleuls\SyliusClickNCollectPlugin\Validator\Constraints\SlotAvailableInterface;

/**
* Checks if a time slot is available.
Expand Down
2 changes: 0 additions & 2 deletions src/Validator/Constraints/SlotAvailableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public function getTargets();
* By default, this is the fully qualified name of the constraint class
* suffixed with "Validator". You can override this method to change that
* behavior.
*
* @return string
*/
public function validatedBy(): string;
}
2 changes: 2 additions & 0 deletions tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ DATABASE_URL=mysql://root@127.0.0.1/coop_tilleuls_sylius_click_n_collect_plugin_
# Delivery is disabled by default via "null://localhost"
MAILER_URL=smtp://localhost
###< symfony/swiftmailer-bundle ###

MESSENGER_TRANSPORT_DSN=sync://
4 changes: 2 additions & 2 deletions tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,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 All @@ -97,7 +97,7 @@ protected function getContainerLoader(ContainerInterface $container): LoaderInte
/* @var ContainerBuilder $container */
Assert::isInstanceOf($container, ContainerBuilder::class);

$locator = new FileLocator($this, $this->getRootDir().'/Resources');
$locator = new FileLocator($this, $this->getProjectDir().'/src/Resources');
$resolver = new LoaderResolver([
new XmlFileLoader($container, $locator),
new YamlFileLoader($container, $locator),
Expand Down
5 changes: 1 addition & 4 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true],
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true],
Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true],
Sylius\Bundle\LocaleBundle\SyliusLocaleBundle::class => ['all' => true],
Expand Down Expand Up @@ -51,16 +51,13 @@
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sylius\Bundle\FixturesBundle\SyliusFixturesBundle::class => ['all' => true],
Sylius\Bundle\PayumBundle\SyliusPayumBundle::class => ['all' => true],
Sylius\Bundle\ThemeBundle\SyliusThemeBundle::class => ['all' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],
CoopTilleuls\SyliusClickNCollectPlugin\CoopTilleulsSyliusClickNCollectPlugin::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],
Expand Down
1 change: 0 additions & 1 deletion tests/Application/config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }

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

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

Expand Down
2 changes: 1 addition & 1 deletion tests/Application/config/packages/dev/jms_serializer.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
jms_serializer:
visitors:
json:
json_serialization:
options:
- JSON_PRETTY_PRINT
- JSON_UNESCAPED_SLASHES
Expand Down
29 changes: 13 additions & 16 deletions tests/Application/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''

doctrine:
dbal:
driver: 'pdo_mysql'
Expand All @@ -14,12 +7,16 @@ doctrine:
url: '%env(resolve:DATABASE_URL)%'

orm:
auto_generate_proxy_classes: '%kernel.debug%'
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/Entity'
prefix: 'Tests\CoopTilleuls\SyliusClickNCollectPlugin\Application\Entity'
alias: App
auto_generate_proxy_classes: true
entity_managers:
default:
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/Entity'
prefix: 'Tests\CoopTilleuls\SyliusClickNCollectPlugin\Application\Entity'
alias: App
default_entity_manager: default

JulieNobody marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion tests/Application/config/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ framework:
secret: '%env(APP_SECRET)%'
form: true
csrf_protection: true
templating: { engines: ["twig"] }
session:
handler_id: ~
2 changes: 1 addition & 1 deletion tests/Application/config/packages/jms_serializer.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jms_serializer:
visitors:
xml:
xml_serialization:
format_output: '%kernel.debug%'
1 change: 0 additions & 1 deletion tests/Application/config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ security:
api:
pattern: "%sylius.security.api_regex%/.*"
provider: sylius_admin_user_provider
fos_oauth: true
stateless: true
anonymous: true

Expand Down
9 changes: 0 additions & 9 deletions tests/Application/config/packages/security_checker.yaml

This file was deleted.

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

This file was deleted.

3 changes: 0 additions & 3 deletions tests/Application/config/routes/sylius_admin.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions tests/Application/config/routes/sylius_admin_api.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions tests/CollectionTime/AvailableSlotsComputerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
use CoopTilleuls\SyliusClickNCollectPlugin\Repository\CollectionTimeRepositoryInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Tests\CoopTilleuls\SyliusClickNCollectPlugin\Application\Entity\Shipment;

/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
final class AvailableSlotsComputerTest extends TestCase
{
use ProphecyTrait;

public function testStartAfterEnd(): void
{
$this->expectException(\InvalidArgumentException::class);
Expand Down
3 changes: 3 additions & 0 deletions tests/CollectionTime/RecurrenceInstanceFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use CoopTilleuls\SyliusClickNCollectPlugin\Entity\Location;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Recurr\Recurrence;
use Tests\CoopTilleuls\SyliusClickNCollectPlugin\Application\Entity\Shipment;

Expand All @@ -26,6 +27,8 @@
*/
class RecurrenceInstanceFinderTest extends TestCase
{
use ProphecyTrait;

public function testNoCollectionTime(): void
{
$this->expectException(\InvalidArgumentException::class);
Expand Down
3 changes: 3 additions & 0 deletions tests/Validator/Constraints/SlotAvailableValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\UnitOfWork;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Recurr\Recurrence;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
Expand All @@ -33,6 +34,8 @@
*/
final class SlotAvailableValidatorTest extends ConstraintValidatorTestCase
{
use ProphecyTrait;

protected function createValidator(): SlotAvailableValidator
{
$unitOfWorkProphecy = $this->prophesize(UnitOfWork::class);
Expand Down