diff --git a/.github/workflows/coding-standard.yml b/.github/workflows/coding-standard.yml new file mode 100644 index 0000000..fa358ed --- /dev/null +++ b/.github/workflows/coding-standard.yml @@ -0,0 +1,10 @@ +name: ExtDN M2 Coding Standard +on: [push, pull_request] + +jobs: + static: + name: M2 Coding Standard + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-coding-standard@master diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..bffde65 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,351 @@ +name: ExtDN M2 Integration Tests +on: [ push, pull_request ] +jobs: + integration-tests-2-4-4-p6-8-1: + name: Magento 2.4.4-p6 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.4-p6 (PHP 8.1) + uses: extdn/github-actions-m2/magento-integration-tests/8.1@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.4-p6' + composer_version: '2' + integration-tests-2-4-4-p6-7-4: + name: Magento 2.4.4-p6 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.4-p6 (PHP 7.4) + uses: extdn/github-actions-m2/magento-integration-tests/7.4@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.4-p6' + composer_version: '2' + integration-tests-2-4-4-p5-7-4: + name: Magento 2.4.4-p5 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.4-p5 (PHP 7.4) + uses: extdn/github-actions-m2/magento-integration-tests/7.4@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.4-p5' + composer_version: '2' + integration-tests-2-4-4-p5-8-1: + name: Magento 2.4.4-p5 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.4-p5 (PHP 8.1) + uses: extdn/github-actions-m2/magento-integration-tests/8.1@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.4-p5' + composer_version: '2' + integration-tests-2-4-5-p5-8-1: + name: Magento 2.4.5-p5 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.5-p5 (PHP 8.1) + uses: extdn/github-actions-m2/magento-integration-tests/8.1@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.5-p5' + composer_version: '2' + integration-tests-2-4-5-p5-7-4: + name: Magento 2.4.5-p5 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.5-p5 (PHP 7.4) + uses: extdn/github-actions-m2/magento-integration-tests/7.4@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.5-p5' + composer_version: '2' + integration-tests-2-4-5-p4-7-4: + name: Magento 2.4.5-p4 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.5-p4 (PHP 7.4) + uses: extdn/github-actions-m2/magento-integration-tests/7.4@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.5-p4' + composer_version: '2' + integration-tests-2-4-5-p4-8-1: + name: Magento 2.4.5-p4 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.5-p4 (PHP 8.1) + uses: extdn/github-actions-m2/magento-integration-tests/8.1@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.5-p4' + composer_version: '2' + integration-tests-2-4-6-p3-8-1: + name: Magento 2.4.6-p3 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.6-p3 (PHP 8.1) + uses: extdn/github-actions-m2/magento-integration-tests/8.1@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.6-p3' + composer_version: '2' + integration-tests-2-4-6-p3-8-2: + name: Magento 2.4.6-p3 PHP 8.2 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.6-p3 (PHP 8.2) + uses: extdn/github-actions-m2/magento-integration-tests/8.2@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.6-p3' + composer_version: '2' + integration-tests-2-4-6-p2-8-2: + name: Magento 2.4.6-p2 PHP 8.2 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.6-p2 (PHP 8.2) + uses: extdn/github-actions-m2/magento-integration-tests/8.2@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.6-p2' + composer_version: '2' + integration-tests-2-4-6-p2-8-1: + name: Magento 2.4.6-p2 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + es: + image: docker.io/wardenenv/elasticsearch:7.8 + ports: + - 9200:9200 + env: + 'discovery.type': single-node + 'xpack.security.enabled': false + ES_JAVA_OPTS: "-Xms64m -Xmx512m" + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + - name: M2 Integration Tests with Magento 2 Version 2.4.6-p2 (PHP 8.1) + uses: extdn/github-actions-m2/magento-integration-tests/8.1@master + with: + module_name: CustomGento_Invoice + composer_name: customgento/module-invoice-m2 + ce_version: '2.4.6-p2' + composer_version: '2' diff --git a/.github/workflows/mess-detector.yml b/.github/workflows/mess-detector.yml new file mode 100644 index 0000000..23e9417 --- /dev/null +++ b/.github/workflows/mess-detector.yml @@ -0,0 +1,10 @@ +name: ExtDN M2 Mess Detector +on: [push, pull_request] + +jobs: + phpmd: + name: M2 Mess Detector + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-mess-detector@master diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..2a81aa7 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,12 @@ +name: ExtDN M2 PHPStan +on: [push, pull_request] + +jobs: + phpstan: + name: M2 PHPStan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-phpstan@master + with: + composer_name: customgento/module-invoice-m2 diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000..8854bf0 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,124 @@ +name: ExtDN M2 Unit Tests +on: [push, pull_request] +jobs: + unit-tests-2-4-4-p6-8-1: + name: Magento 2.4.4-p6 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/8.1@master + env: + MAGENTO_VERSION: '2.4.4-p6' + unit-tests-2-4-4-p6-7-4: + name: Magento 2.4.4-p6 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/7.4@master + env: + MAGENTO_VERSION: '2.4.4-p6' + unit-tests-2-4-4-p5-7-4: + name: Magento 2.4.4-p5 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/7.4@master + env: + MAGENTO_VERSION: '2.4.4-p5' + unit-tests-2-4-4-p5-8-1: + name: Magento 2.4.4-p5 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/8.1@master + env: + MAGENTO_VERSION: '2.4.4-p5' + unit-tests-2-4-5-p5-8-1: + name: Magento 2.4.5-p5 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/8.1@master + env: + MAGENTO_VERSION: '2.4.5-p5' + unit-tests-2-4-5-p5-7-4: + name: Magento 2.4.5-p5 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/7.4@master + env: + MAGENTO_VERSION: '2.4.5-p5' + unit-tests-2-4-5-p4-7-4: + name: Magento 2.4.5-p4 PHP 7.4 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/7.4@master + env: + MAGENTO_VERSION: '2.4.5-p4' + unit-tests-2-4-5-p4-8-1: + name: Magento 2.4.5-p4 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/8.1@master + env: + MAGENTO_VERSION: '2.4.5-p4' + unit-tests-2-4-6-p3-8-1: + name: Magento 2.4.6-p3 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/8.1@master + env: + MAGENTO_VERSION: '2.4.6-p3' + unit-tests-2-4-6-p3-8-2: + name: Magento 2.4.6-p3 PHP 8.2 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/8.2@master + env: + MAGENTO_VERSION: '2.4.6-p3' + unit-tests-2-4-6-p2-8-1: + name: Magento 2.4.6-p2 PHP 8.1 Integration Tests + runs-on: ubuntu-latest + env: + MODULE_NAME: CustomGento_Invoice + COMPOSER_NAME: customgento/module-invoice-m2 + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-unit-tests/8.1@master + env: + MAGENTO_VERSION: '2.4.6-p2' diff --git a/Plugin/OfflinePayments/Model/Purchaseorder/AddAdminCheckPlugin.php b/Plugin/OfflinePayments/Model/Purchaseorder/AddAdminCheckPlugin.php index ddc26fc..9e393d1 100644 --- a/Plugin/OfflinePayments/Model/Purchaseorder/AddAdminCheckPlugin.php +++ b/Plugin/OfflinePayments/Model/Purchaseorder/AddAdminCheckPlugin.php @@ -27,6 +27,9 @@ public function __construct(Config $config, State $state) $this->state = $state; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function afterIsAvailable(Purchaseorder $subject, bool $result): bool { // if some other rule forbids this payment method, we forbid it as well diff --git a/Plugin/OfflinePayments/Model/Purchaseorder/AddCustomerGroupCheckPlugin.php b/Plugin/OfflinePayments/Model/Purchaseorder/AddCustomerGroupCheckPlugin.php index f74f3c3..18e4487 100644 --- a/Plugin/OfflinePayments/Model/Purchaseorder/AddCustomerGroupCheckPlugin.php +++ b/Plugin/OfflinePayments/Model/Purchaseorder/AddCustomerGroupCheckPlugin.php @@ -20,6 +20,9 @@ public function __construct(Config $config) $this->config = $config; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function afterIsAvailable(Purchaseorder $subject, bool $result, CartInterface $quote = null): bool { // if some other rule forbids this payment method, we forbid it as well diff --git a/Test/Integration/PurchaseorderTest.php b/Test/Integration/PurchaseorderTest.php index 8d2fd50..b2cb611 100644 --- a/Test/Integration/PurchaseorderTest.php +++ b/Test/Integration/PurchaseorderTest.php @@ -27,7 +27,7 @@ class PurchaseorderTest extends TestCase */ private $quote; - protected function setUp() + protected function setUp(): void { $this->objectManager = Bootstrap::getObjectManager(); $this->paymentMethod = $this->objectManager->get(Purchaseorder::class); diff --git a/Test/Unit/Model/ConfigTest.php b/Test/Unit/Model/ConfigTest.php index d53106a..8ddb87e 100644 --- a/Test/Unit/Model/ConfigTest.php +++ b/Test/Unit/Model/ConfigTest.php @@ -21,7 +21,7 @@ class ConfigTest extends TestCase */ private $config; - protected function setUp() + protected function setUp(): void { $this->scopeConfig = $this->createMock(ScopeConfigInterface::class); $this->config = new Config($this->scopeConfig);