Skip to content

Instantiate adapter via factory #18

Instantiate adapter via factory

Instantiate adapter via factory #18

name: REST
on:
pull_request:
branches:
- 3.x
jobs:
api-functional-test:
runs-on: "ubuntu-latest"
# Only run api tests on feature branches. Simple documentation updates, formatting can be ignored
if: contains(github.head_ref, 'feature')
name: ${{ matrix.job_title }}
strategy:
fail-fast: true
matrix:
magento:
[
"magento/project-community-edition:>=2.4.4 <2.4.5",
"magento/project-community-edition:>=2.4.5 <2.4.6",
"magento/project-community-edition:>=2.4.6 <2.4.7",
"magento/project-community-edition:>=2.4.7 <2.4.8",
]
include:
- magento: magento/project-community-edition:>=2.4.4 <2.4.5
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
job_title: "2.4.4"
- magento: magento/project-community-edition:>=2.4.5 <2.4.6
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
job_title: "2.4.5"
- magento: magento/project-community-edition:>=2.4.6 <2.4.7
php: 8.2
composer: 2.2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.17.9"
rabbitmq: "rabbitmq:3.12-management"
redis: "redis:7.0"
job_title: "2.4.6"
- magento: magento/project-community-edition:>=2.4.7 <2.4.8
php: 8.3
composer: 2.7
mysql: "mariadb:10.6"
elasticsearch: "elasticsearch:7.17.9"
rabbitmq: "rabbitmq:3.12-management"
redis: "redis:7.2"
job_title: "2.4.7"
services:
elasticsearch:
image: ${{ matrix.elasticsearch }}
env:
discovery.type: single-node
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 9200:9200
mysql:
image: ${{ matrix.mysql }}
env:
MYSQL_DATABASE: magento_functional_tests
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
rabbitmq:
image: ${{ matrix.rabbitmq }}
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- 5672:5672
- 15672:15672
steps:
- uses: actions/checkout@v4
- name: Set PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:2
coverage: none
- run: composer create-project --repository-url="https://mirror.mage-os.org/" "${{ matrix.magento }}" ../magento2 --no-install
shell: bash
env:
COMPOSER_AUTH: ""
name: Create Magento ${{ matrix.magento }} Project
- uses: graycoreio/github-actions-magento2/get-magento-version@main
id: magento-version
with:
working-directory: "../magento2"
- name: Get Composer Cache Directory
shell: bash
working-directory: "../magento2"
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
uses: actions/cache@v4
with:
key: "composer | v5 | '' | ${{ hashFiles('composer.lock') }}"
path: ${{ steps.composer-cache.outputs.dir }}
- run: composer config repositories.local path $GITHUB_WORKSPACE
name: Add Github Repo for Testing
working-directory: "../magento2"
shell: bash
- run: |
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true
composer config --no-interaction allow-plugins.magento/* true
name: Fixup Composer Plugins
working-directory: "../magento2"
- run: composer require aligent/async-events "@dev" --no-update && composer install
name: Require and attempt install
working-directory: "../magento2"
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ secrets.composer_auth }}
- name: Replace Configuration Settings for env
working-directory: ../magento2/dev/tests/api-functional
run: |
cp phpunit_rest.xml.dist phpunit_rest.xml
cp config/install-config-mysql.php.dist config/install-config-mysql.php
sed -i 's/name="TESTS_MAGENTO_INSTALLATION" value="disabled"/name="TESTS_MAGENTO_INSTALLATION" value="enabled"/' phpunit_rest.xml
sed -i 's#http://magento.url#http://127.0.0.1:8082/index.php/#' phpunit_rest.xml
sed -i 's/value="admin"/value="Test Webservice User"/' phpunit_rest.xml
sed -i 's/value="123123q"/value="Test Webservice API key"/' phpunit_rest.xml
sed -i "s,http://localhost/,http://127.0.0.1:8082/index.php/," config/install-config-mysql.php
sed -i "s/'db-host' => 'localhost'/'db-host' => '127.0.0.1'/" config/install-config-mysql.php
sed -i "s/'db-user' => 'root'/'db-user' => 'user'/" config/install-config-mysql.php
sed -i "s/'db-password' => ''/'db-password' => 'password'/" config/install-config-mysql.php
sed -i "s/'elasticsearch-host' => 'localhost'/'elasticsearch-host' => '127.0.0.1'/" config/install-config-mysql.php
- run: |
php -S 127.0.0.1:8082 -t ./pub/ ./phpserver/router.php &
sleep 5
vendor/bin/phpunit -c $(pwd)/dev/tests/api-functional/phpunit_rest.xml vendor/aligent/async-events/Test/Api
working-directory: ../magento2
name: Run API Functional Tests