Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit db50493

Browse files
committedJul 13, 2023
refactor: use provider/processor instead of event listeners
1 parent 27f2096 commit db50493

File tree

111 files changed

+3634
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3634
-479
lines changed
 

‎.github/workflows/ci.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,3 +863,150 @@ jobs:
863863
run: tests/Fixtures/app/console cache:clear --ansi
864864
- name: Run Behat tests
865865
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction
866+
867+
phpunit_legacy:
868+
name: PHPUnit Legacy event listeners (PHP ${{ matrix.php }})
869+
env:
870+
EVENT_LISTENERS_BACKWARD_COMPATIBILITY_LAYER: 1
871+
runs-on: ubuntu-latest
872+
timeout-minutes: 20
873+
strategy:
874+
matrix:
875+
php:
876+
- '8.2'
877+
include:
878+
- php: '8.2'
879+
coverage: true
880+
fail-fast: false
881+
steps:
882+
- name: Checkout
883+
uses: actions/checkout@v3
884+
- name: Setup PHP
885+
uses: shivammathur/setup-php@v2
886+
with:
887+
php-version: ${{ matrix.php }}
888+
tools: pecl, composer
889+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
890+
coverage: pcov
891+
ini-values: memory_limit=-1
892+
- name: Get composer cache directory
893+
id: composercache
894+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
895+
- name: Cache dependencies
896+
uses: actions/cache@v3
897+
with:
898+
path: ${{ steps.composercache.outputs.dir }}
899+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
900+
restore-keys: ${{ runner.os }}-composer-
901+
- name: Enable code coverage
902+
if: matrix.coverage
903+
run: echo "COVERAGE=1" >> $GITHUB_ENV
904+
- name: Update project dependencies
905+
run: composer update --no-interaction --no-progress --ansi
906+
- name: Install PHPUnit
907+
run: vendor/bin/simple-phpunit --version
908+
- name: Clear test app cache
909+
run: tests/Fixtures/app/console cache:clear --ansi
910+
- name: Run PHPUnit tests
911+
run: |
912+
mkdir -p build/logs/phpunit
913+
if [ "$COVERAGE" = '1' ]; then
914+
vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --coverage-clover build/logs/phpunit/clover.xml
915+
else
916+
vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml
917+
fi
918+
- name: Upload test artifacts
919+
if: always()
920+
uses: actions/upload-artifact@v3
921+
with:
922+
name: phpunit-logs-php${{ matrix.php }}
923+
path: build/logs/phpunit
924+
continue-on-error: true
925+
- name: Upload coverage results to Codecov
926+
if: matrix.coverage
927+
uses: codecov/codecov-action@v3
928+
with:
929+
directory: build/logs/phpunit
930+
name: phpunit-php${{ matrix.php }}
931+
flags: phpunit
932+
fail_ci_if_error: true
933+
continue-on-error: true
934+
- name: Upload coverage results to Coveralls
935+
if: matrix.coverage
936+
env:
937+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
938+
run: |
939+
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls
940+
export PATH="$PATH:$HOME/.composer/vendor/bin"
941+
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml
942+
continue-on-error: true
943+
944+
behat_legacy:
945+
name: Behat Legacy event listeners (PHP ${{ matrix.php }})
946+
env:
947+
EVENT_LISTENERS_BACKWARD_COMPATIBILITY_LAYER: 1
948+
runs-on: ubuntu-latest
949+
timeout-minutes: 20
950+
strategy:
951+
matrix:
952+
php:
953+
- '8.2'
954+
fail-fast: false
955+
steps:
956+
- name: Checkout
957+
uses: actions/checkout@v3
958+
- name: Setup PHP
959+
uses: shivammathur/setup-php@v2
960+
with:
961+
php-version: ${{ matrix.php }}
962+
tools: pecl, composer
963+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
964+
coverage: pcov
965+
ini-values: memory_limit=-1
966+
- name: Get composer cache directory
967+
id: composercache
968+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
969+
- name: Cache dependencies
970+
uses: actions/cache@v3
971+
with:
972+
path: ${{ steps.composercache.outputs.dir }}
973+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
974+
restore-keys: ${{ runner.os }}-composer-
975+
- name: Update project dependencies
976+
run: composer update --no-interaction --no-progress --ansi
977+
- name: Install PHPUnit
978+
run: vendor/bin/simple-phpunit --version
979+
- name: Clear test app cache
980+
run: tests/Fixtures/app/console cache:clear --ansi
981+
- name: Run Behat tests (PHP 8)
982+
run: |
983+
mkdir -p build/logs/behat
984+
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=legacy --no-interaction
985+
- name: Upload test artifacts
986+
if: always()
987+
uses: actions/upload-artifact@v3
988+
with:
989+
name: behat-logs-php${{ matrix.php }}
990+
path: build/logs/behat
991+
continue-on-error: true
992+
- name: Export OpenAPI documents
993+
run: |
994+
mkdir -p build/out/openapi
995+
tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json
996+
tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml
997+
- name: Setup node
998+
uses: actions/setup-node@v3
999+
with:
1000+
node-version: '14'
1001+
- name: Validate OpenAPI documents
1002+
run: |
1003+
npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.json
1004+
npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.yaml
1005+
- name: Upload OpenAPI artifacts
1006+
if: always()
1007+
uses: actions/upload-artifact@v3
1008+
with:
1009+
name: openapi-docs-php${{ matrix.php }}
1010+
path: build/out/openapi
1011+
continue-on-error: true
1012+

‎behat.yml.dist

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ default:
1616
- 'Behat\MinkExtension\Context\MinkContext'
1717
- 'behatch:context:rest'
1818
filters:
19-
tags: '~@postgres&&~@mongodb&&~@elasticsearch'
19+
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@controller'
2020
extensions:
2121
'FriendsOfBehat\SymfonyExtension':
2222
bootstrap: 'tests/Fixtures/app/bootstrap.php'
@@ -52,7 +52,7 @@ postgres:
5252
- 'Behat\MinkExtension\Context\MinkContext'
5353
- 'behatch:context:rest'
5454
filters:
55-
tags: '~@sqlite&&~@mongodb&&~@elasticsearch'
55+
tags: '~@sqlite&&~@mongodb&&~@elasticsearch&&~@controller'
5656

5757
mongodb:
5858
suites:
@@ -142,3 +142,39 @@ elasticsearch-coverage:
142142
- 'ApiPlatform\Tests\Behat\CoverageContext'
143143
- 'Behat\MinkExtension\Context\MinkContext'
144144
- 'behatch:context:rest'
145+
146+
legacy:
147+
suites:
148+
default:
149+
contexts:
150+
- 'ApiPlatform\Tests\Behat\CommandContext'
151+
- 'ApiPlatform\Tests\Behat\DoctrineContext'
152+
- 'ApiPlatform\Tests\Behat\GraphqlContext'
153+
- 'ApiPlatform\Tests\Behat\JsonContext'
154+
- 'ApiPlatform\Tests\Behat\HydraContext'
155+
- 'ApiPlatform\Tests\Behat\OpenApiContext'
156+
- 'ApiPlatform\Tests\Behat\HttpCacheContext'
157+
- 'ApiPlatform\Tests\Behat\JsonApiContext'
158+
- 'ApiPlatform\Tests\Behat\JsonHalContext'
159+
- 'ApiPlatform\Tests\Behat\MercureContext'
160+
- 'ApiPlatform\Tests\Behat\XmlContext'
161+
- 'Behat\MinkExtension\Context\MinkContext'
162+
- 'behatch:context:rest'
163+
filters:
164+
tags: '~@postgres&&~@mongodb&&~@elasticsearch'
165+
extensions:
166+
'FriendsOfBehat\SymfonyExtension':
167+
bootstrap: 'tests/Fixtures/app/bootstrap.php'
168+
kernel:
169+
environment: 'test'
170+
debug: true
171+
class: AppKernel
172+
path: 'tests/Fixtures/app/AppKernel.php'
173+
'Behat\MinkExtension':
174+
base_url: 'http://example.com/'
175+
files_path: 'features/files'
176+
sessions:
177+
default:
178+
symfony: ~
179+
'Behatch\Extension': ~
180+

0 commit comments

Comments
 (0)
Please sign in to comment.