-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from BitBagCommerce/feature/OP-370-add-sylius-1…
….13-support Upgrade plugin to Sylius 1.13 compatibility
- Loading branch information
Showing
32 changed files
with
2,210 additions
and
1,099 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,26 +11,31 @@ on: | |
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-latest | ||
|
||
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: ["8.1", "8.2"] | ||
symfony: ["^5.4", "^6.0"] | ||
sylius: ["~1.12.0"] | ||
node: ["14.x"] | ||
php: ["8.0", "8.1", "8.2", "8.3"] | ||
symfony: ["^5.4", "^6.4"] | ||
sylius: ["~1.12.0", "~1.13.0"] | ||
node: ["^18.0", "^20.0"] | ||
mysql: ["8.0"] | ||
exclude: | ||
- sylius: "~1.13.0" | ||
php: "8.0" | ||
- symfony: "^6.4" | ||
php: "8.0" | ||
|
||
env: | ||
APP_ENV: test | ||
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}" | ||
|
||
steps: | ||
- | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- | ||
name: Setup PHP | ||
|
@@ -43,7 +48,7 @@ jobs: | |
|
||
- | ||
name: Setup Node | ||
uses: actions/setup-node@v1 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "${{ matrix.node }}" | ||
|
||
|
@@ -81,7 +86,7 @@ jobs: | |
|
||
- | ||
name: Cache Composer | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} | ||
|
@@ -133,7 +138,7 @@ jobs: | |
name: Prepare test application assets | ||
run: | | ||
(cd tests/Application && bin/console assets:install public -vvv) | ||
(cd tests/Application && yarn build) | ||
(cd tests/Application && yarn encore dev) | ||
- | ||
name: Prepare test application cache | ||
|
@@ -151,6 +156,10 @@ jobs: | |
name: Validate database schema | ||
run: (cd tests/Application && bin/console doctrine:schema:validate) | ||
|
||
- | ||
name: Run ECS | ||
run: vendor/bin/ecs check src | ||
|
||
- | ||
name: Run PHPStan | ||
run: vendor/bin/phpstan analyse | ||
|
@@ -165,13 +174,13 @@ jobs: | |
|
||
- | ||
name: Upload Behat logs | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: Behat logs | ||
path: etc/build/ | ||
if-no-files-found: ignore | ||
|
||
- | ||
name: Failed build Slack notification | ||
uses: rtCamp/action-slack-notify@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer; | ||
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Symplify\EasyCodingStandard\ValueObject\Option; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php'); | ||
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php'); | ||
|
||
$containerConfigurator->parameters()->set(Option::SKIP, [ | ||
VisibilityRequiredFixer::class => ['*Spec.php'], | ||
]); | ||
declare(strict_types=1); | ||
|
||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
|
||
return static function (ECSConfig $config): void { | ||
putenv('ALLOW_BITBAG_OS_HEADER=1'); | ||
|
||
$config->import('vendor/bitbag/coding-standard/ecs.php'); | ||
$config->paths(['src', 'tests']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,11 @@ Feature: Managing shipping gateway | |
And it has "package_length" field set to "22" | ||
And it has "cod_payment_method_code" field set to "stripe_checkout" | ||
And it has "collect_on_delivery_form" field set to "BANK_TRANSFER" | ||
And the store has a product "Chicken" priced at "$2" in "Web-US" channel | ||
And the store has a product "Chicken" priced at "$2.00" in "Web-US" channel | ||
And customer "[email protected]" has placed 5 orders on the "Web-US" channel in each buying 5 "Chicken" products | ||
And the customer set the shipping address "Mike Ross" addressed it to "350 5th Ave", "10118" "New York" in the "United States" to orders | ||
And those orders were placed with "DPD Express" shipping method | ||
And set product weight to "10" | ||
And set product weight to "10.00" | ||
And set units to the shipment | ||
|
||
@ui | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
@@ -104,11 +105,11 @@ public function getServices(): array | |
]; | ||
} | ||
|
||
if (method_exists($this->getOrder(), 'getDpdCud') && $this->getOrder()->getDpdCud() === true) { | ||
if (method_exists($this->getOrder(), 'getDpdCud') && true === $this->getOrder()->getDpdCud()) { | ||
$services['cud'] = ''; | ||
} | ||
|
||
if (method_exists($this->getOrder(), 'getDpdGuarantee') && $this->getOrder()->getDpdGuarantee() !== null) { | ||
if (method_exists($this->getOrder(), 'getDpdGuarantee') && null !== $this->getOrder()->getDpdGuarantee()) { | ||
$services['guarantee'] = [ | ||
'type' => $this->getOrder()->getDpdGuarantee(), | ||
]; | ||
|
@@ -193,11 +194,11 @@ private function resolveWeekend(\DateTime $date): \DateTime | |
{ | ||
$dayOfWeek = (int) $date->format('N'); | ||
|
||
if ($dayOfWeek === 6) { | ||
if (6 === $dayOfWeek) { | ||
return $date->modify('+2 days'); | ||
} | ||
|
||
if ($dayOfWeek === 7) { | ||
if (7 === $dayOfWeek) { | ||
return $date->modify('+1 day'); | ||
} | ||
|
||
|
@@ -216,6 +217,6 @@ private function getPostCode(): string | |
|
||
$postCode = $shippingAddress->getPostcode(); | ||
|
||
return $postCode !== null ? str_replace('-', '', $postCode) : ''; | ||
return null !== $postCode ? str_replace('-', '', $postCode) : ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
@@ -42,7 +43,7 @@ public function __construct( | |
RequestStack $requestStack, | ||
FileSystem $fileSystem, | ||
ObjectManager $shippingExportManager, | ||
string $shippingLabelsPath | ||
string $shippingLabelsPath, | ||
) { | ||
$this->webClient = $webClient; | ||
$this->requestStack = $requestStack; | ||
|
@@ -60,7 +61,7 @@ public function exportShipment(ResourceControllerEvent $exportShipmentEvent): vo | |
$shippingGateway = $shippingExport->getShippingGateway(); | ||
Assert::notNull($shippingGateway); | ||
|
||
if ($shippingGateway->getCode() !== self::DPD_GATEWAY_CODE) { | ||
if (self::DPD_GATEWAY_CODE !== $shippingGateway->getCode()) { | ||
return; | ||
} | ||
|
||
|
@@ -79,7 +80,7 @@ public function exportShipment(ResourceControllerEvent $exportShipmentEvent): vo | |
$shippingGateway->getConfigValue('id'), | ||
$shippingGateway->getConfigValue('login'), | ||
$shippingGateway->getConfigValue('password'), | ||
$shippingGateway->getConfigValue('wsdl') | ||
$shippingGateway->getConfigValue('wsdl'), | ||
); | ||
|
||
$dpd->setSender($this->webClient->getSender()); | ||
|
@@ -90,8 +91,8 @@ public function exportShipment(ResourceControllerEvent $exportShipmentEvent): vo | |
} catch (Exception $exception) { | ||
$session->getFlashBag()->add('error', sprintf( | ||
'DPD Web Service for #%s order: %s', | ||
$shipment->getOrder() !== null ? (string) $shipment->getOrder()->getNumber() : '', | ||
$exception->getMessage() | ||
null !== $shipment->getOrder() ? (string) $shipment->getOrder()->getNumber() : '', | ||
$exception->getMessage(), | ||
)); | ||
|
||
return; | ||
|
@@ -105,7 +106,7 @@ public function exportShipment(ResourceControllerEvent $exportShipmentEvent): vo | |
public function saveShippingLabel( | ||
ShippingExportInterface $shippingExport, | ||
string $labelContent, | ||
string $labelExtension | ||
string $labelExtension, | ||
): void { | ||
$labelPath = $this->shippingLabelsPath | ||
. '/' . $this->getFilename($shippingExport) | ||
|
@@ -135,7 +136,7 @@ private function getFilename(ShippingExportInterface $shippingExport): string | |
[ | ||
$shipmentId, | ||
preg_replace('~[^A-Za-z0-9]~', '', (string) $orderNumber), | ||
] | ||
], | ||
); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
* 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
APP_SECRET='ch4mb3r0f5ecr3ts' | ||
|
||
KERNEL_CLASS='Tests\BitBag\DpdPlShippingExportPlugin\Application\Kernel' | ||
|
||
DATABASE_URL=mysql://[email protected]/DPD_shipping_%kernel.environment%?serverVersion=8.0 |
Oops, something went wrong.