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

Upgrade 1.13 #52

Merged
merged 5 commits into from
Aug 6, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @BitBagCommerce
* @Sylius/core-team
27 changes: 15 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ on:
- 'dependabot/**'
pull_request: ~
release:
types: [ created ]
types: [created]
schedule:
- cron: "0 1 * * 6" # Run at 1am every Saturday
workflow_dispatch: ~

jobs:
tests:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }},
MySQL ${{ matrix.mysql }}"

strategy:
fail-fast: false
matrix:
php: [ 8.0 ]
symfony: [ ^5.4, ^6.0 ]
sylius: [ ~1.11.0, ~1.12.0 ]
node: [ 14.x ]
mysql: [ 5.7, 8.0 ]
php: ["8.0", "8.1", "8.2", "8.3"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["^20.x"]
mysql: ["8.0"]

exclude:
-
sylius: ~1.11.0
symfony: ^6.0
- sylius: "~1.13.0"
php: "8.0"

env:
APP_ENV: test
Expand Down Expand Up @@ -130,8 +130,11 @@ jobs:
- name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)

- name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/

- name: Run ECS
run: vendor/bin/ecs check src
run: vendor/bin/ecs check src tests/Behat

- name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
Expand Down
89 changes: 0 additions & 89 deletions .github/workflows/coding_standard.yml

This file was deleted.

21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "^1.11 || ^1.12"
"sylius/sylius": "^1.12 || ^1.13"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "^v2.0.1",
"bitbag/coding-standard": "^3.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand All @@ -28,23 +28,24 @@
"friends-of-behat/variadic-extension": "^1.3",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan": "1.4",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.14",
"vimeo/psalm": "4.24.0"
"doctrine/persistence": "^3.0"
},
"conflict": {
"composer/composer": "2.3.9"
"behat/mink-selenium2-driver": ">=1.7.0",
"doctrine/annotations": ">1.15"
},
"config": {
"sort-packages": true,
Expand Down
18 changes: 5 additions & 13 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
return static function (ECSConfig $config): void {
putenv('ALLOW_BITBAG_OS_HEADER=1');

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$parameters->set(Option::SKIP, [
__DIR__ . '/tests/Application/var',
__DIR__ . '/vendor'
]);
$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'tests']);
};
6 changes: 3 additions & 3 deletions features/banner.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ Feature: Adding a new banner
@ui
Scenario: Adding a new banner
When I fill form with "TEST-SECTION" section, "TEST-AD" ad, "en_US" and "100" priority
And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8000/en_US"
And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8080/en_US"
And I submit form
Then I should be notified that it has been successfully created
And "TEST-AD" ad should has 1 banners

@ui
Scenario: Adding 2 banners to one ad
When I fill form with "TEST-SECTION" section, "TEST-AD" ad, "en_US" and "100" priority
And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8000/en_US"
And I add new image "ford.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8080/en_US"
And I submit form
Then I should be notified that it has been successfully created
And I am on new banner page
And I fill form with "TEST-SECTION" section, "TEST-AD" ad, "en_US" and "150" priority
And I add new image "troll.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8000/en_US"
And I add new image "troll.jpg" and fill alt as "test-alt" and link as "http://127.0.0.1:8080/en_US"
And I submit form
Then I should be notified that it has been successfully created
And "TEST-AD" ad should has 2 banners
2 changes: 1 addition & 1 deletion src/Controller/Action/CountClicksAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class CountClicksAction

public function __construct(
BannerRepositoryInterface $bannerRepository,
ObjectManager $objectManager
ObjectManager $objectManager,
) {
$this->bannerRepository = $bannerRepository;
$this->objectManager = $objectManager;
Expand Down
4 changes: 2 additions & 2 deletions src/DataProvider/GetAdsBannersDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public function __construct(AdRepositoryInterface $adRepository, BannersProvider
public function supports(
string $resourceClass,
string $operationName = null,
array $context = []
array $context = [],
): bool {
return Banner::class === $resourceClass;
}

public function getCollection(
string $resourceClass,
string $operationName = null,
array $context = []
array $context = [],
): iterable {
$localeCode = $context['filters']['locale_code'] ?? null;
$sectionCode = $context['filters']['section_code'] ?? null;
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/BannerPathGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function generate(BannerInterface $banner): string

return $this->expandPath(
sprintf('%s.%s', $hash, $file->guessExtension()),
self::PATH_PREFIX
self::PATH_PREFIX,
);
}

Expand All @@ -36,7 +36,7 @@ private function expandPath(string $path, string $pathPrefix): string
$pathPrefix,
substr($path, 0, 2),
substr($path, 2, 2),
substr($path, 4)
substr($path, 4),
);
}
}
4 changes: 2 additions & 2 deletions src/Operator/BannersOperator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class BannersOperator implements BannersOperatorInterface
public function operate(
AdInterface $ad,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
/** @var Collection<int, BannerInterface> $adBanners */
$adBanners = $ad->getBanners();
Expand All @@ -44,7 +44,7 @@ public function operate(
private function filterBannersBySectionAndLocale(
Collection $adBanners,
string $sectionCode,
string $localeCode
string $localeCode,
): Collection {
return $adBanners->filter(function (BannerInterface $banner) use ($sectionCode, $localeCode) {
if (null !== $banner->getLocale() &&
Expand Down
2 changes: 1 addition & 1 deletion src/Operator/BannersOperatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ interface BannersOperatorInterface
public function operate(
AdInterface $ad,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array;
}
4 changes: 2 additions & 2 deletions src/Provider/BannersProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(BannersOperatorInterface $bannersOperator)
public function getAdsBanners(
array $ads,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
$banners = [];

Expand All @@ -44,7 +44,7 @@ public function getAdsBanners(
public function getAdBanners(
AdInterface $ad,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
return $this->bannersOperator->operate($ad, $sectionCode, $localeCode);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Provider/BannersProviderInterface.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

declare(strict_types=1);

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

namespace BitBag\SyliusBannerPlugin\Provider;

use BitBag\SyliusBannerPlugin\Entity\AdInterface;
Expand All @@ -18,12 +18,12 @@ interface BannersProviderInterface
public function getAdsBanners(
array $ads,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array;

public function getAdBanners(
AdInterface $ad,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array;
}
4 changes: 2 additions & 2 deletions src/Twig/Extension/BannerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getFunctions(): array

public function getActiveAdsBannersBySectionAndLocale(
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
$ads = $this->adRepository->findAllActiveAds();

Expand All @@ -52,7 +52,7 @@ public function getActiveAdsBannersBySectionAndLocale(
public function getActiveAdBannersByCodeSectionAndLocale(
string $adCode,
string $sectionCode,
string $localeCode
string $localeCode,
): ?array {
$ad = $this->adRepository->findActiveAdByCode($adCode);

Expand Down
2 changes: 1 addition & 1 deletion src/Uploader/BannerUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function upload(BannerInterface $banner): void

$this->filesystem->write(
$path,
$fileContents
$fileContents,
);
}

Expand Down
Loading
Loading