From 5a3b4c449777eb5c2929504e79129bbacbe48642 Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Wed, 17 Aug 2022 14:40:19 +0200 Subject: [PATCH 1/4] Fixed issue with readonly class name --- .../System/Config/Frontend/{Readonly.php => ReadonlyField.php} | 2 +- etc/adminhtml/system/integration.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Block/Adminhtml/System/Config/Frontend/{Readonly.php => ReadonlyField.php} (94%) diff --git a/Block/Adminhtml/System/Config/Frontend/Readonly.php b/Block/Adminhtml/System/Config/Frontend/ReadonlyField.php similarity index 94% rename from Block/Adminhtml/System/Config/Frontend/Readonly.php rename to Block/Adminhtml/System/Config/Frontend/ReadonlyField.php index e23a7a6..241c97a 100755 --- a/Block/Adminhtml/System/Config/Frontend/Readonly.php +++ b/Block/Adminhtml/System/Config/Frontend/ReadonlyField.php @@ -15,7 +15,7 @@ * * Make input field readonly */ -class Readonly extends Field +class ReadonlyField extends Field { /** diff --git a/etc/adminhtml/system/integration.xml b/etc/adminhtml/system/integration.xml index 50c2da6..b4c2628 100755 --- a/etc/adminhtml/system/integration.xml +++ b/etc/adminhtml/system/integration.xml @@ -20,7 +20,7 @@ - Datatrics\Connect\Block\Adminhtml\System\Config\Frontend\Readonly + Datatrics\Connect\Block\Adminhtml\System\Config\Frontend\ReadonlyField datatrics_connect_general/integration/token Date: Thu, 18 Aug 2022 09:36:27 +0200 Subject: [PATCH 2/4] Update magento versions used in the CI pipeline --- .github/workflows/phpstan.yml | 16 ++++++------- .github/workflows/setup-di-compile.yml | 23 ++++++++++--------- .../workflows/templates/docker-compose.yml | 18 +++++++++++++++ 3 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/templates/docker-compose.yml diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 58ca333..8c695b8 100755 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -6,12 +6,9 @@ jobs: strategy: matrix: include: - - PHP_VERSION: php72-fpm - MAGENTO_VERSION: 2.3.3 - - PHP_VERSION: php73-fpm - MAGENTO_VERSION: 2.3.6-p1 - - PHP_VERSION: php74-fpm - MAGENTO_VERSION: 2.4.2 + - PHP_VERSION: php81-fpm + MAGENTO_VERSION: 2.4.4 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -26,7 +23,10 @@ jobs: run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ - name: Install the extensions in Magento - run: docker exec magento-project-community-edition composer require datatrics/magento2-integration:dev-continuous-integration-test-branch fooman/phpstan-magento2-magic-methods:^0.7 phpstan/phpstan:0.* + run: docker exec magento-project-community-edition composer require datatrics/magento2-integration:dev-continuous-integration-test-branch + + - name: Activate the extension + run: docker exec magento-project-community-edition bash -c "php bin/magento module:enable Datatrics_Connect && php bin/magento setup:upgrade && php bin/magento setup:di:compile" - name: Run PHPStan - run: docker exec magento-project-community-edition /bin/bash -c "./vendor/bin/phpstan analyse -c /data/extensions/*/phpstan.neon /data/extensions" + run: docker exec magento-project-community-edition /bin/bash -c "./vendor/bin/phpstan analyse --no-progress -c /data/extensions/*/phpstan.neon /data/extensions" \ No newline at end of file diff --git a/.github/workflows/setup-di-compile.yml b/.github/workflows/setup-di-compile.yml index a09d82b..c75da08 100755 --- a/.github/workflows/setup-di-compile.yml +++ b/.github/workflows/setup-di-compile.yml @@ -1,4 +1,4 @@ -name: setup:di:compile +name: Run setup:upgrade and setup:di:compile on: [pull_request] jobs: @@ -9,24 +9,25 @@ jobs: - PHP_VERSION: php72-fpm MAGENTO_VERSION: 2.3.3 - PHP_VERSION: php73-fpm - MAGENTO_VERSION: 2.3.6-p1 + MAGENTO_VERSION: 2.3.7 - PHP_VERSION: php74-fpm MAGENTO_VERSION: 2.4.2 + - PHP_VERSION: php74-fpm + MAGENTO_VERSION: 2.4.3-with-replacements + - PHP_VERSION: php81-fpm + MAGENTO_VERSION: 2.4.4 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Start Docker - run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }} + run: PHP_VERSION=${{ matrix.PHP_VERSION }} MAGENTO_VERSION=magento${{ matrix.MAGENTO_VERSION }} docker-compose -f .github/workflows/templates/docker-compose.yml up -d - name: Create branch for Composer and remove version from composer.json run: git checkout -b continuous-integration-test-branch && sed -i '/version/d' ./composer.json - - name: Upload our code into the docker container - run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ - - - name: Install the extension in Magento - run: docker exec magento-project-community-edition composer require datatrics/magento2-integration:dev-continuous-integration-test-branch + - name: Upload the code into the docker container + run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ && docker exec magento-project-community-edition composer require datatrics/magento2-integration:dev-continuous-integration-test-branch - - name: Run setup:di:compile - run: docker exec magento-project-community-edition php bin/magento setup:di:compile + - name: Activate the extension and run setup:upgrade and setup:di:compile + run: docker exec magento-project-community-edition bash -c "php bin/magento module:enable Datatrics_Connect && php bin/magento setup:upgrade && php bin/magento setup:di:compile" diff --git a/.github/workflows/templates/docker-compose.yml b/.github/workflows/templates/docker-compose.yml new file mode 100644 index 0000000..bd555ba --- /dev/null +++ b/.github/workflows/templates/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3' + +services: + db: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root_password + MYSQL_DATABASE: magento-test + MYSQL_USER: magento + MYSQL_PASSWORD: magento + MYSQL_SQL_TO_RUN: 'GRANT ALL ON *.* TO "root"@"%";' + web: + image: michielgerritsen/magento-project-community-edition:${PHP_VERSION}-${MAGENTO_VERSION} + container_name: magento-project-community-edition + depends_on: + - db + volumes: + - ./:/data/extensions/workdir \ No newline at end of file From 5acf7a7bd31e6817899abf3e4ad7f11ea474b92d Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Thu, 18 Aug 2022 09:37:18 +0200 Subject: [PATCH 3/4] Fixed raised PHPStan warnings --- Model/Source/CategoryList.php | 20 +++++-------------- Service/ProductData/Data.php | 4 ++-- .../system/config/button/debug.phtml | 3 +-- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Model/Source/CategoryList.php b/Model/Source/CategoryList.php index e7a20e5..b3e5094 100755 --- a/Model/Source/CategoryList.php +++ b/Model/Source/CategoryList.php @@ -7,7 +7,6 @@ namespace Datatrics\Connect\Model\Source; -use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Model\ResourceModel\Category\Collection; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; use Magento\Framework\Data\OptionSourceInterface; @@ -25,10 +24,6 @@ class CategoryList implements OptionSourceInterface * @var array */ public $options = []; - /** - * @var CategoryFactory - */ - private $categoryFactory; /** * @var CollectionFactory */ @@ -37,14 +32,11 @@ class CategoryList implements OptionSourceInterface /** * CategoryList constructor. * - * @param CategoryFactory $categoryFactory * @param CollectionFactory $categoryCollectionFactory */ public function __construct( - CategoryFactory $categoryFactory, CollectionFactory $categoryCollectionFactory ) { - $this->categoryFactory = $categoryFactory; $this->categoryCollectionFactory = $categoryCollectionFactory; } @@ -112,18 +104,16 @@ public function getCategoryCollection() * * @return string */ - public function getCategoryPath(string $path, array $categoryList) : string + public function getCategoryPath(string $path, array $categoryList): string { $categoryPath = []; $rootCats = [1, 2]; $path = explode('/', $path); - if (!empty($path)) { - foreach ($path as $catId) { - if (!in_array($catId, $rootCats)) { - if (!empty($categoryList[$catId]['name'])) { - $categoryPath[] = $categoryList[$catId]['name']; - } + foreach ($path as $catId) { + if (!in_array($catId, $rootCats)) { + if (!empty($categoryList[$catId]['name'])) { + $categoryPath[] = $categoryList[$catId]['name']; } } } diff --git a/Service/ProductData/Data.php b/Service/ProductData/Data.php index a790c21..4b44fb0 100755 --- a/Service/ProductData/Data.php +++ b/Service/ProductData/Data.php @@ -128,8 +128,8 @@ public function execute(array $entityIds, array $attributeMap, array $extraParam $result = $this->price->execute( $entityIds, - $productsBehaviour['grouped']['price_logic'] ?? 'max', - $productsBehaviour['bundle']['price_logic'] ?? 'min', + $extraParameters['behaviour']['grouped']['price_logic'] ?? 'max', + $extraParameters['behaviour']['bundle']['price_logic'] ?? 'min', $storeId ); foreach ($result as $entityId => $priceData) { diff --git a/view/adminhtml/templates/system/config/button/debug.phtml b/view/adminhtml/templates/system/config/button/debug.phtml index a981d8c..2a5289a 100755 --- a/view/adminhtml/templates/system/config/button/debug.phtml +++ b/view/adminhtml/templates/system/config/button/debug.phtml @@ -15,5 +15,4 @@
-getButtonHtml() ?> - +getButtonHtml() ?> \ No newline at end of file From 96c52650d528e32993af29add8aa2e702b3eea79 Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Thu, 18 Aug 2022 09:37:24 +0200 Subject: [PATCH 4/4] Version bump --- composer.json | 2 +- etc/config.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 51a22e2..648d889 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "datatrics/magento2-integration", "description": "Datatrics Connect extension for Magento 2", "type": "magento2-module", - "version": "1.6.0", + "version": "1.6.1", "license": [ "BSD-2-Clause" ], diff --git a/etc/config.xml b/etc/config.xml index 7b16bb9..0a2bb65 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -10,7 +10,7 @@ - v1.6.0 + v1.6.1 0 Magento 2 0