fix: ensure no error WebTestCase::createClient() with prior kernel boot
#358
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHPUnit | |
| on: | |
| push: | |
| paths: &paths | |
| - .github/workflows/phpunit.yml | |
| - config/** | |
| - skeleton/** | |
| - src/** | |
| - tests/** | |
| - composer.json | |
| - phpunit* | |
| pull_request: | |
| paths: *paths | |
| schedule: | |
| - cron: '0 0 1,16 * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: P:${{ matrix.php }}, S:${{ matrix.symfony }}, D:${{ matrix.database }}, PU:${{ matrix.phpunit }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}${{ matrix.use-phpunit-extension != 1 && ' (no phpunit extension)' || '' }}${{ (matrix.use-php-84-lazy-objects != 1 || matrix.php != '8.4') && ' (legacy proxy)' || '' }}${{ matrix.use-dama != 1 && ' (no dama)' || '' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [ 8.4, 8.5 ] | |
| symfony: [ 6.4.*, 7.4.*, 8.0.* ] | |
| database: [ mysql|mongo ] | |
| phpunit: [ 13 ] | |
| use-dama: [ 1 ] | |
| use-phpunit-extension: [ 1 ] | |
| use-php-84-lazy-objects: [ 1 ] | |
| deps: [ highest ] | |
| include: | |
| # old php versions | |
| - {php: 8.1, symfony: 6.4.*, phpunit: 9, database: mysql, use-phpunit-extension: 0} | |
| - {php: 8.2, symfony: 6.4.*, phpunit: 9, database: mysql, use-phpunit-extension: 0} | |
| # old PHPUnit versions | |
| - {php: 8.3, symfony: 7.4.*, phpunit: 9, database: mysql, use-phpunit-extension: 0} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 10, database: mysql, use-phpunit-extension: 0} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 11, database: mysql, use-phpunit-extension: 0} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 11, database: mysql} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql, use-phpunit-extension: 0} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 12, database: mysql} | |
| # test with no database (PHPUnit 9 is used to prevent some problems with empty data providers) | |
| - {php: 8.3, symfony: 7.4.*, phpunit: 9, database: none, use-phpunit-extension: 0} | |
| - {php: 8.3, symfony: 7.4.*, phpunit: 9, database: none, deps: lowest, use-phpunit-extension: 0} | |
| # One permutation per DBMS | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: mongo} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: pgsql} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: sqlite} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: mysql} | |
| # lowest deps (one per DBMS) | |
| - {php: 8.3, symfony: 6.4.*, phpunit: 9, database: mysql|mongo, deps: lowest, use-phpunit-extension: 0} | |
| - {php: 8.3, symfony: 6.4.*, phpunit: 9, database: mongo, deps: lowest, use-phpunit-extension: 0} | |
| - {php: 8.3, symfony: 6.4.*, phpunit: 9, database: pgsql, deps: lowest, use-phpunit-extension: 0} | |
| - {php: 8.3, symfony: 6.4.*, phpunit: 9, database: sqlite, deps: lowest, use-phpunit-extension: 0} | |
| - {php: 8.3, symfony: 6.4.*, phpunit: 9, database: mysql, deps: lowest, use-phpunit-extension: 0} | |
| # Lowest deps with PHP 8.4 & lazy objects | |
| - {php: 8.4, symfony: 6.4.*, phpunit: 13, database: mysql|mongo, deps: lowest} | |
| # Disable Foundry's PHPUnit extension and/or dama | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: mysql|mongo, use-phpunit-extension: 0} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: mysql, use-phpunit-extension: 0, use-dama: 0} | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: mysql, use-dama: 0} | |
| # disable lazy objects in PHP 8.4 | |
| - {php: 8.4, symfony: 7.4.*, phpunit: 13, database: mysql|mongo, use-php-84-lazy-objects: 0} | |
| env: | |
| DATABASE_URL: ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/foundry?serverVersion=15' || contains(matrix.database, 'sqlite') && 'sqlite:///%kernel.project_dir%/var/data.db' || '' }} | |
| MONGO_URL: ${{ contains(matrix.database, 'mongo') && 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' || '' }} | |
| USE_DAMA_DOCTRINE_TEST_BUNDLE: ${{ contains(matrix.database, 'sql') && matrix.use-dama != 0 && 1 || 0 }} | |
| USE_FOUNDRY_PHPUNIT_EXTENSION: ${{ matrix.use-phpunit-extension || 0 }} | |
| USE_PHP_84_LAZY_OBJECTS: ${{ matrix.use-php-84-lazy-objects }} | |
| PHPUNIT_VERSION: ${{ matrix.phpunit }} | |
| WITH_LOWEST_DEPENDENCIES: ${{ matrix.deps == 'lowest' && 1 || 0 }} | |
| services: | |
| postgres: | |
| image: ${{ contains(matrix.database, 'pgsql') && 'postgres:15' || '' }} | |
| env: | |
| POSTGRES_USER: root | |
| POSTGRES_PASSWORD: root | |
| POSTGRES_DB: foundry | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| mongo: | |
| image: ${{ contains(matrix.database, 'mongo') && 'mongo:4' || '' }} | |
| ports: | |
| - 27017:27017 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| tools: flex | |
| - name: Add the polyfill compatible with Doctrine ^2.16 | |
| if: ${{ matrix.deps == 'lowest' }} | |
| shell: bash | |
| run: composer require --dev symfony/polyfill-php80:^1.16 --no-update | |
| - name: Install dependencies | |
| uses: ramsey/composer-install@v2 | |
| with: | |
| dependency-versions: ${{ matrix.deps }} | |
| composer-options: --prefer-dist | |
| env: | |
| SYMFONY_REQUIRE: ${{ matrix.symfony }} | |
| - name: Set up MySQL | |
| if: contains(matrix.database, 'mysql') | |
| run: sudo /etc/init.d/mysql start | |
| - name: Test | |
| run: ./phpunit | |
| shell: bash | |
| env: | |
| SYMFONY_REQUIRE: ${{ matrix.symfony }} | |
| test-reset-database: | |
| name: Reset DB - D:${{ matrix.database }} ${{ matrix.use-dama == 1 && ' (dama)' || '' }} ${{ matrix.reset-database-mode == 'migrate' && ' (migrate)' || '' }} ${{ contains(matrix.with-migration-configuration-file, 'transactional') && '(configuration file transactional)' || contains(matrix.with-migration-configuration-file, 'configuration') && '(configuration file)' || '' }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}${{ matrix.use-phpunit-extension == 0 && ' (no phpunit extension)' || '' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| database: [ mysql, pgsql, sqlite, mysql|mongo ] | |
| use-dama: [ 0, 1 ] | |
| reset-database-mode: [ schema, migrate ] | |
| migration-configuration-file: ['no'] | |
| deps: [ highest, lowest ] | |
| use-phpunit-extension: [ 1 ] | |
| include: | |
| - { database: mongo, use-dama: 0, reset-database-mode: schema, use-phpunit-extension: 1 } | |
| - { database: pgsql, use-dama: 1, reset-database-mode: schema, use-phpunit-extension: 0 } | |
| - { database: pgsql, use-dama: 0, reset-database-mode: schema, use-phpunit-extension: 0 } | |
| - { database: pgsql, migration-configuration-file: 'migration-configuration', use-dama: 0, reset-database-mode: migration, use-phpunit-extension: 1 } | |
| - { database: pgsql, migration-configuration-file: 'migration-configuration-transactional', use-dama: 0, reset-database-mode: migration, use-phpunit-extension: 1 } | |
| env: | |
| DATABASE_URL: ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/foundry?serverVersion=15' || 'sqlite:///%kernel.project_dir%/var/data.db' }} | |
| MONGO_URL: ${{ contains(matrix.database, 'mongo') && 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' || '' }} | |
| USE_DAMA_DOCTRINE_TEST_BUNDLE: ${{ matrix.use-dama == 1 && 1 || 0 }} | |
| DATABASE_RESET_MODE: ${{ matrix.reset-database-mode == 1 && 1 || 0 }} | |
| MIGRATION_CONFIGURATION_FILE: ${{ matrix.migration-configuration-file == 'no' && '' || format('tests/Fixture/MigrationTests/configs/{0}.php', matrix.migration-configuration-file) }} | |
| PHPUNIT_VERSION: 13 | |
| WITH_LOWEST_DEPENDENCIES: ${{ matrix.deps == 'lowest' && 1 || 0 }} | |
| USE_FOUNDRY_PHPUNIT_EXTENSION: ${{ matrix.use-phpunit-extension }} | |
| services: | |
| postgres: | |
| image: ${{ contains(matrix.database, 'pgsql') && 'postgres:15' || '' }} | |
| env: | |
| POSTGRES_USER: root | |
| POSTGRES_PASSWORD: root | |
| POSTGRES_DB: foundry | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| mongo: | |
| image: ${{ contains(matrix.database, 'mongo') && 'mongo:4' || '' }} | |
| ports: | |
| - 27017:27017 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.5 | |
| coverage: none | |
| tools: flex | |
| - name: Install dependencies | |
| uses: ramsey/composer-install@v2 | |
| with: | |
| dependency-versions: ${{ matrix.deps }} | |
| composer-options: --prefer-dist | |
| env: | |
| SYMFONY_REQUIRE: 7.4.* | |
| - name: Set up MySQL | |
| if: contains(matrix.database, 'mysql') | |
| run: sudo /etc/init.d/mysql start | |
| - name: Test | |
| run: | | |
| ./phpunit --testsuite reset-database --bootstrap tests/bootstrap-reset-database.php | |
| # We should be able to run the tests twice in order to check if the second run also starts from a fresh db | |
| # some bugs could be detected this way | |
| ./phpunit --testsuite reset-database --bootstrap tests/bootstrap-reset-database.php | |
| shell: bash | |
| env: | |
| SYMFONY_REQUIRE: 7.4.* | |
| test-no-framework: | |
| name: No framework - PHP${{ matrix.php }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [ 8.3, 8.4, 8.5 ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| tools: flex | |
| - name: Install dependencies | |
| uses: ramsey/composer-install@v2 | |
| with: | |
| composer-options: --prefer-dist | |
| - name: Remove framework dependencies | |
| run: | | |
| composer remove --dev \ | |
| dama/doctrine-test-bundle \ | |
| doctrine/doctrine-bundle \ | |
| doctrine/doctrine-migrations-bundle \ | |
| doctrine/mongodb-odm-bundle \ | |
| symfony/maker-bundle \ | |
| symfony/flex \ | |
| symfony/phpunit-bridge \ | |
| symfony/framework-bundle | |
| - name: Test | |
| run: | | |
| vendor/bin/phpunit tests/Unit | |
| test-with-paratest: | |
| name: Test with paratest | |
| runs-on: ubuntu-latest | |
| env: | |
| DATABASE_URL: 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' | |
| MONGO_URL: 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' | |
| services: | |
| mongo: | |
| image: 'mongo:4' | |
| ports: | |
| - 27017:27017 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.5 | |
| coverage: none | |
| tools: flex | |
| - name: Install dependencies | |
| uses: ramsey/composer-install@v2 | |
| with: | |
| dependency-versions: highest | |
| composer-options: --prefer-dist | |
| env: | |
| SYMFONY_REQUIRE: 8.0.* | |
| - name: Set up MySQL | |
| run: sudo /etc/init.d/mysql start | |
| - name: Install paratest | |
| run: composer require brianium/paratest --dev | |
| shell: bash | |
| - name: Test | |
| run: vendor/bin/paratest --processes 1 --configuration phpunit-paratest.xml.dist | |
| shell: bash | |
| code-coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| env: | |
| DATABASE_URL: postgresql://root:root@localhost:5432/foundry?serverVersion=15 | |
| MONGO_URL: mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb | |
| USE_DAMA_DOCTRINE_TEST_BUNDLE: 1 | |
| USE_FOUNDRY_PHPUNIT_EXTENSION: 1 | |
| USE_PHP_84_LAZY_OBJECTS: 1 | |
| PHPUNIT_VERSION: 13 | |
| FOUNDRY_FAKER_SEED: 1234 | |
| services: | |
| mongo: | |
| image: mongo:4 | |
| ports: | |
| - 27017:27017 | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: root | |
| POSTGRES_PASSWORD: root | |
| POSTGRES_DB: foundry | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.5 | |
| coverage: xdebug | |
| ini-values: xdebug.mode=coverage | |
| tools: flex | |
| - name: Install dependencies | |
| uses: ramsey/composer-install@v2 | |
| with: | |
| composer-options: --prefer-dist | |
| env: | |
| SYMFONY_REQUIRE: 8.0.x | |
| - name: Test with coverage | |
| run: ./phpunit --coverage-text --coverage-clover coverage.xml | |
| shell: bash | |
| env: | |
| SYMFONY_DEPRECATIONS_HELPER: disabled | |
| - name: Publish coverage report to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |