diff --git a/.github/Dockerfile b/.github/Dockerfile index 4b181e872b..d332e07776 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -13,6 +13,7 @@ OPENSEARCH_SERVER="" \ OPENSEARCH_PORT=9200 \ OPENSEARCH_INDEX_PREFIX=magento2 \ OPENSEARCH_TIMEOUT=15 \ +OPENSEARCH_VERSION="" \ ADMIN_NAME=admin \ ADMIN_LASTNAME=admin \ ADMIN_EMAIL=admin@example.com \ diff --git a/.github/Makefile b/.github/Makefile index 8038ee0e6c..007f585b27 100644 --- a/.github/Makefile +++ b/.github/Makefile @@ -1,11 +1,11 @@ # Install N98-Magerun -n98-magerun2.phar: - wget -q https://files.magerun.net/n98-magerun2.phar - chmod +x ./n98-magerun2.phar +build-n98-magerun2: + wget -q https://files.magerun.net/n98-magerun2-${N98_MAGERUN_VERSION}.phar + chmod +x ./n98-magerun2-${N98_MAGERUN_VERSION}.phar # Check Magento installation -sys-check: n98-magerun2.phar - ./n98-magerun2.phar sys:check +sys-check: build-n98-magerun2 + ./n98-magerun2-${N98_MAGERUN_VERSION}.phar sys:check # Install Magento (without starting Apache) magento: @@ -26,7 +26,7 @@ dev-module: bin/magento setup:upgrade # Configuration -configure: n98-magerun2.phar +configure: bin/magento config:set payment/adyen_abstract/demo_mode 1 bin/magento adyen:enablepaymentmethods:run bin/magento config:set payment/adyen_abstract/has_holder_name 1 @@ -49,8 +49,8 @@ configure: n98-magerun2.phar bin/magento config:set payment/adyen_abstract/client_key_test "${ADYEN_CLIENT_KEY}" bin/magento config:set payment/adyen_abstract/notification_username 'admin' bin/magento config:set payment/adyen_abstract/payment_methods_active 1 - ./n98-magerun2.phar config:store:set --encrypt payment/adyen_abstract/notification_password '1234' > /dev/null - ./n98-magerun2.phar config:store:set --encrypt payment/adyen_abstract/api_key_test "${ADYEN_API_KEY}" > /dev/null + ./n98-magerun2-${N98_MAGERUN_VERSION}.phar config:store:set --encrypt payment/adyen_abstract/notification_password '1234' > /dev/null + ./n98-magerun2-${N98_MAGERUN_VERSION}.phar config:store:set --encrypt payment/adyen_abstract/api_key_test "${ADYEN_API_KEY}" > /dev/null # Clear cache flush: diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml index 7cac6d4056..3033481a75 100644 --- a/.github/docker-compose.yml +++ b/.github/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3' - services: db: image: mariadb:10.4 @@ -12,7 +10,7 @@ services: MARIADB_USER: magento MARIADB_PASSWORD: magento opensearch: - image: bitnami/opensearch:2 + image: bitnami/opensearch:${OPENSEARCH_VERSION} container_name: opensearch-container networks: - backend @@ -38,6 +36,8 @@ services: environment: DB_SERVER: mariadb OPENSEARCH_SERVER: opensearch-container + OPENSEARCH_VERSION: + N98_MAGERUN_VERSION: MAGENTO_HOST: magento2.test.com VIRTUAL_HOST: magento2.test.com COMPOSER_MEMORY_LIMIT: -1 diff --git a/.github/scripts/install_magento.sh b/.github/scripts/install_magento.sh index ad81930bcc..375360e313 100644 --- a/.github/scripts/install_magento.sh +++ b/.github/scripts/install_magento.sh @@ -21,12 +21,20 @@ else fi if [ "$OPENSEARCH_SERVER" != "" ]; then - MAGENTO_INSTALL_ARGS=$(echo \ - --search-engine="opensearch" \ - --opensearch-host="$OPENSEARCH_SERVER" \ - --opensearch-port="$OPENSEARCH_PORT" \ - --opensearch-index-prefix="$OPENSEARCH_INDEX_PREFIX" \ - --opensearch-timeout="$OPENSEARCH_TIMEOUT") + if [ "$OPENSEARCH_VERSION" -eq 2 ]; then + MAGENTO_INSTALL_ARGS=$(echo \ + --search-engine="opensearch" \ + --opensearch-host="$OPENSEARCH_SERVER" \ + --opensearch-port="$OPENSEARCH_PORT" \ + --opensearch-index-prefix="$OPENSEARCH_INDEX_PREFIX" \ + --opensearch-timeout="$OPENSEARCH_TIMEOUT") + else + MAGENTO_INSTALL_ARGS=$(echo \ + --elasticsearch-host="$OPENSEARCH_SERVER" \ + --elasticsearch-port="$OPENSEARCH_PORT" \ + --elasticsearch-index-prefix="$OPENSEARCH_INDEX_PREFIX" \ + --elasticsearch-timeout="$OPENSEARCH_TIMEOUT") + fi RET=1 while [ $RET -ne 0 ]; do echo "Checking if $OPENSEARCH_SERVER is available." diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 12baaccd5f..7bfaab419a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: jobs: - analyze: + codeql_analyze_job: name: Analyze runs-on: ubuntu-latest timeout-minutes: 25 diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index eb62f7dd3b..1c1f7398c8 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -27,13 +27,14 @@ on: default: "main" jobs: - build: + run_e2e_test_job: + name: Run E2E tests if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_dispatch') environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} strategy: matrix: - php-version: ["8.3"] - magento-version: ["2.4.7-p2"] + php-version: ["8.1"] + magento-version: ["2.4.4-p12","2.4.7-p4"] runs-on: group: larger-runners labels: ubuntu-latest-8-cores @@ -54,6 +55,8 @@ jobs: - run: echo "TEST_GROUP=${{ env.IS_RELEASE == 'TRUE' && 'all' || (inputs.testGroup || 'standard') }}" >> $GITHUB_ENV - run: echo "TEST_BRANCH=${{ (env.IS_RELEASE == 'TRUE' || !inputs.testBranch) && 'develop' || inputs.testBranch }}" >> $GITHUB_ENV - run: echo "EXPRESS_BRANCH=${{ contains(fromJSON('["all", "express-checkout"]'), env.TEST_GROUP) && (inputs.expressBranch || 'main') || '' }}" >> $GITHUB_ENV + - run: echo "OPENSEARCH_VERSION=${{ contains(matrix.magento-version, '2.4.4') && '1' || '2' }}" >> $GITHUB_ENV + - run: echo "N98_MAGERUN_VERSION=${{ contains(matrix.magento-version, '2.4.4') && '7.5.0' || 'latest' }}" >> $GITHUB_ENV - name: Information run: echo "E2E testing against test suite branch ${{env.TEST_BRANCH}} using group ${{env.TEST_GROUP}} ${{ env.EXPRESS_BRANCH && 'with express module branch' || '' }} ${{ env.EXPRESS_BRANCH || '' }}" diff --git a/.github/workflows/graphql-test.yml b/.github/workflows/graphql-test.yml index 7cfb3fcb1a..223be29e35 100644 --- a/.github/workflows/graphql-test.yml +++ b/.github/workflows/graphql-test.yml @@ -2,7 +2,8 @@ name: GraphQL Tests on: [pull_request, pull_request_target] jobs: - build: + run_graphql_test_job: + name: Run GraphQL API functional tests if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} strategy: @@ -14,6 +15,8 @@ jobs: env: PHP_VERSION: ${{ matrix.php-version }} MAGENTO_VERSION: ${{ matrix.magento-version }} + OPENSEARCH_VERSION: 2 + N98_MAGERUN_VERSION: latest ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}} ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}} DONATION_ACCOUNT: ${{secrets.DONATION_ACCOUNT}} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a098ffa893..bb151a1076 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,8 @@ on: workflow_dispatch: jobs: - build: + run_main_test_job: + name: Run unit tests and code sniffer if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_dispatch') environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} runs-on: ubuntu-latest diff --git a/.github/workflows/mftf-test.yml b/.github/workflows/mftf-test.yml index 8544feb1ec..1b844902bd 100644 --- a/.github/workflows/mftf-test.yml +++ b/.github/workflows/mftf-test.yml @@ -7,7 +7,8 @@ on: branches: [main] jobs: - build: + mftf_job: + name: Run Magento Functional Test Framework if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} strategy: @@ -20,6 +21,7 @@ jobs: env: PHP_VERSION: ${{ matrix.php-version }} MAGENTO_VERSION: ${{ matrix.magento-version }} + OPENSEARCH_VERSION: 2 ADMIN_USERNAME: ${{ secrets.MAGENTO_ADMIN_USERNAME }} ADMIN_PASSWORD: ${{ secrets.MAGENTO_ADMIN_PASSWORD }} DONATION_ACCOUNT: ${{secrets.DONATION_ACCOUNT}} diff --git a/.github/workflows/restapi-test.yml b/.github/workflows/restapi-test.yml index 229ae5c92c..3c97b4d2fb 100644 --- a/.github/workflows/restapi-test.yml +++ b/.github/workflows/restapi-test.yml @@ -2,7 +2,8 @@ name: REST API Tests on: [pull_request, pull_request_target] jobs: - build: + rest_test_job: + name: Run REST API functional tests if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} strategy: @@ -14,6 +15,8 @@ jobs: env: PHP_VERSION: ${{ matrix.php-version }} MAGENTO_VERSION: ${{ matrix.magento-version }} + OPENSEARCH_VERSION: 2 + N98_MAGERUN_VERSION: latest ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}} ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}} DONATION_ACCOUNT: ${{secrets.DONATION_ACCOUNT}} diff --git a/Block/Adminhtml/System/Config/Field/Tokenization.php b/Block/Adminhtml/System/Config/Field/Tokenization.php index 909cc94029..b13bde1ae1 100644 --- a/Block/Adminhtml/System/Config/Field/Tokenization.php +++ b/Block/Adminhtml/System/Config/Field/Tokenization.php @@ -60,7 +60,7 @@ protected function _prepareToRender(): void ); } - private function getEnabledRenderer(): SelectYesNo|BlockInterface + private function getEnabledRenderer(): BlockInterface { if (!$this->enabledRenderer) { $this->enabledRenderer = $this->getLayout()->createBlock( diff --git a/Model/Sales/OrderRepository.php b/Model/Sales/OrderRepository.php index 0919294075..be9a11dab7 100644 --- a/Model/Sales/OrderRepository.php +++ b/Model/Sales/OrderRepository.php @@ -64,7 +64,7 @@ public function __construct( $this->filterGroupBuilder = $filterGroupBuilder; } - public function getOrderByQuoteId(int $quoteId): OrderInterface|false + public function getOrderByQuoteId(int $quoteId) { $quoteIdFilter = $this->filterBuilder->setField('quote_id') ->setConditionType('eq')