Skip to content
Merged
20 changes: 20 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,23 @@ jobs:
uploadCoverage: true
secrets:
codecovToken: '${{ secrets.CODECOV_TOKEN }}'

smoke_test:
runs-on: ubuntu-latest
steps:
- uses: shopware/github-actions/setup-extension@main
with:
extensionName: ${{ github.event.repository.name }}
install: true
install-admin: true
install-storefront: true
extraRepositories: |
{
"${{ github.event.repository.name }}": {
"type": "path",
"url": "custom/plugins/${{ github.event.repository.name }}",
"symlink": true
}
}
- name: Uninstall Plugin
run: php bin/console plugin:uninstall ${{ github.event.repository.name }}
4 changes: 2 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ parameters:
- src/Resources

symfony:
constant_hassers: false
constantHassers: false
containerXmlPath: '../../..%ShopwareHashedCacheDir%/%ShopwareKernelClass%DevDebugContainer.xml'
consoleApplicationLoader: %ShopwareRoot%/src/Core/DevOps/StaticAnalyze/console-application.php

type_perfect:
narrow_return: true
narrow_param: true
narrow_param: true
2 changes: 1 addition & 1 deletion src/DataProvider/CategoryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\Log\Package;
use Swag\PlatformDemoData\Resources\helper\TranslationHelper;
use Swag\PlatformDemoData\helper\TranslationHelper;

#[Package('fundamentals@after-sales')]
class CategoryProvider extends DemoDataProvider
Expand Down
2 changes: 1 addition & 1 deletion src/DataProvider/CmsPageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Doctrine\DBAL\Connection;
use Shopware\Core\Content\Cms\DataResolver\FieldConfig;
use Shopware\Core\Framework\Log\Package;
use Swag\PlatformDemoData\Resources\helper\TranslationHelper;
use Swag\PlatformDemoData\helper\TranslationHelper;

#[Package('fundamentals@after-sales')]
class CmsPageProvider extends DemoDataProvider
Expand Down
4 changes: 3 additions & 1 deletion src/DataProvider/CustomerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#[Package('fundamentals@after-sales')]
class CustomerProvider extends DemoDataProvider
{
public const CUSTOMER_ID = '6c97534c2c0747f39e8751e43cb2b013';

private Connection $connection;

/**
Expand Down Expand Up @@ -56,7 +58,7 @@ public function getPayload(): array

return [
[
'id' => '6c97534c2c0747f39e8751e43cb2b013',
'id' => self::CUSTOMER_ID,
'defaultPaymentMethodId' => $paymentMethodId,
'salutationId' => $salutationId,
'salesChannelId' => $salesChannelId,
Expand Down
13 changes: 12 additions & 1 deletion src/DataProvider/ProductProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
use Shopware\Core\Defaults;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Uuid\Uuid;
use Swag\PlatformDemoData\Resources\helper\TranslationHelper;
use Swag\PlatformDemoData\helper\ProductReviewHelper;
use Swag\PlatformDemoData\helper\TranslationHelper;

#[Package('fundamentals@after-sales')]
class ProductProvider extends DemoDataProvider
Expand All @@ -25,10 +26,13 @@ class ProductProvider extends DemoDataProvider

private TranslationHelper $translationHelper;

private ProductReviewHelper $productReviewHelper;

public function __construct(Connection $connection)
{
$this->connection = $connection;
$this->translationHelper = new TranslationHelper($connection);
$this->productReviewHelper = new ProductReviewHelper();
}

public function getAction(): string
Expand Down Expand Up @@ -56,6 +60,7 @@ public function getPayload(): array
{
$taxId = $this->getTaxId();
$storefrontSalesChannel = $this->getStorefrontSalesChannel();
$enLanguageId = Defaults::LANGUAGE_SYSTEM;

return [
[
Expand Down Expand Up @@ -142,6 +147,7 @@ public function getPayload(): array
'visibility' => ProductVisibilityDefinition::VISIBILITY_ALL,
],
],
'productReviews' => $this->productReviewHelper->createReviews($storefrontSalesChannel, $enLanguageId),
],
[
'id' => '1901dc5e888f4b1ea4168c2c5f005540',
Expand Down Expand Up @@ -207,6 +213,7 @@ public function getPayload(): array
'id' => '77421c4f75af40c8a57657cdc2ad49a2',
],
],
'productReviews' => $this->productReviewHelper->createReviews($storefrontSalesChannel, $enLanguageId),
],
[
'id' => '2a88d9b59d474c7e869d8071649be43c',
Expand Down Expand Up @@ -279,6 +286,7 @@ public function getPayload(): array
'id' => 'dc6f98beeca44852beb078a9e8e21e7d',
],
],
'productReviews' => $this->productReviewHelper->createReviews($storefrontSalesChannel, $enLanguageId),
],
[
'id' => '3ac014f329884b57a2cce5a29f34779c',
Expand Down Expand Up @@ -341,6 +349,7 @@ public function getPayload(): array
'id' => 'c53fa30db00e4a84b4516f6b07c02e8d',
],
],
'productReviews' => $this->productReviewHelper->createReviews($storefrontSalesChannel, $enLanguageId),
],
[
'id' => '43a23e0c03bf4ceabc6055a2185faa87',
Expand Down Expand Up @@ -500,6 +509,7 @@ public function getPayload(): array
],
],
],
'productReviews' => $this->productReviewHelper->createReviews($storefrontSalesChannel, $enLanguageId),
],
[
'id' => 'c7bca22753c84d08b6178a50052b4146',
Expand Down Expand Up @@ -625,6 +635,7 @@ public function getPayload(): array
],
],
],
'productReviews' => $this->productReviewHelper->createReviews($storefrontSalesChannel, $enLanguageId),
],
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/DataProvider/PropertyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Doctrine\DBAL\Connection;
use Shopware\Core\Content\Property\PropertyGroupDefinition;
use Shopware\Core\Framework\Log\Package;
use Swag\PlatformDemoData\Resources\helper\TranslationHelper;
use Swag\PlatformDemoData\helper\TranslationHelper;

#[Package('fundamentals@after-sales')]
class PropertyProvider extends DemoDataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

namespace Swag\PlatformDemoData\Resources\helper;
namespace Swag\PlatformDemoData\helper;

use Doctrine\DBAL\Connection;
use Shopware\Core\Defaults;
Expand Down
177 changes: 177 additions & 0 deletions src/helper/ProductReviewHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?php

declare(strict_types=1);
/*
* (c) shopware AG <info@shopware.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Swag\PlatformDemoData\helper;

use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Uuid\Uuid;
use Swag\PlatformDemoData\DataProvider\CustomerProvider;

#[Package('fundamentals@after-sales')]
class ProductReviewHelper
{
/**
* @return array<int, array<string, mixed>>
*/
public function createReviews(string $salesChannelId, string $languageId): array
{
return [
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Very good',
'content' => 'Excellent product! The quality is top notch, everything works perfectly and exceeds my expectations. I definitely recommend buying it.',
'points' => 5.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Outstanding Quality',
'content' => 'Top product! High-quality build, easy to use, and fast delivery. I would buy it again anytime',
'points' => 5.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Exceeded Expectations',
'content' => 'Absolutely delighted. Exactly as described, even better than expected.',
'points' => 5.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Perfect Choice',
'content' => 'Perfect! Exactly what I was looking for. Works flawlessly.',
'points' => 5.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Good',
'content' => 'Very good product with minor flaws. Overall, I am satisfied; it offers good value for money.',
'points' => 4.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Very Solid Product',
'content' => 'Overall a very good product. Minor flaws, but nothing serious.',
'points' => 4.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Great Value for Money',
'content' => 'Solid product with good value for money. I would recommend it.',
'points' => 4.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Satisfactory',
'content' => 'The product is fine, serves its purpose, but there is nothing special about it. Acceptable for the price.',
'points' => 3.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Does the Job',
'content' => 'Okay for everyday use. Does its job, but there are definitely better alternatives.',
'points' => 3.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Average Experience',
'content' => 'Average. Neither particularly good nor particularly bad.',
'points' => 3.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Poor',
'content' => 'Unfortunately disappointing. The quality is mediocre and there were several problems during use.',
'points' => 2.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Disappointing Durability',
'content' => 'Unfortunately not very durable. Problems appeared after a short time.',
'points' => 2.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Good Idea, Weak Execution',
'content' => 'The idea is good, but the execution is lacking.',
'points' => 2.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Very poor',
'content' => 'Absolutely not recommended. The product is defective, does not work as described and appears to be cheaply made.',
'points' => 1.0,
'status' => true,
],
[
'id' => Uuid::randomHex(),
'salesChannelId' => $salesChannelId,
'customerId' => CustomerProvider::CUSTOMER_ID,
'languageId' => $languageId,
'title' => 'Not Worth It',
'content' => 'Very disappointing. Poor quality and not functional upon delivery.',
'points' => 1.0,
'status' => true,
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

namespace Swag\PlatformDemoData\Resources\helper;
namespace Swag\PlatformDemoData\helper;

use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Log\Package;
Expand Down
Loading