Skip to content

Replace uses of deprecated Connection::query() method #492

Replace uses of deprecated Connection::query() method

Replace uses of deprecated Connection::query() method #492

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
tests:
name: Symfony ${{ matrix.symfony-version }} on PHP ${{ matrix.php-version }} flags ${{ matrix.composer-flags }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Symfony 5.4 requires PHP >= 7.2, it will be installed on PHP 7.4
# Symfony 6.0 requires PHP >= 8.0, it will be installed on PHP >= 8.0
php-version: ['8.0']
composer-flags: ['']
symfony-version: ['']
include:
- php-version: 7.4
# Use "update" instead of "install" since it allows using the "--prefer-lowest" option
composer-flags: "update --prefer-lowest"
- php-version: 7.4
# add a specific job to test Symfony 4.4, otherwise Symfony 5.4 would be installed
symfony-version: "^4.4"
composer-flags: "require --dev --no-progress doctrine/annotations:^1.8.0"
- php-version: 7.4
# add a specific job to test 5.4 for all Symfony packages
symfony-version: "^5.4"
- php-version: 8.1
# add a specific job to test ^6.0 for all Symfony packages
symfony-version: "^6.0"
- php-version: 8.1
# Remove doctrine/phpcr-* in order to allow doctrine/persistence v3
composer-flags: "remove --dev --no-progress doctrine/phpcr-bundle doctrine/phpcr-odm"
- php-version: 8.2
# Remove doctrine/phpcr-* in order to allow doctrine/persistence v3
composer-flags: "remove --dev --no-progress doctrine/phpcr-bundle doctrine/phpcr-odm"
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: acme
ports:
- 3306:3306
postgresql:
image: postgres:9.6
env:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'postgres'
POSTGRES_DB: 'postgres'
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.symfony-version }}-
- name: Require Symfony
if: matrix.symfony-version != ''
run: |
composer require --no-update symfony/flex
composer config extra.symfony.require "${{ matrix.symfony-version }}"
composer require --no-update symfony/framework-bundle=${{ matrix.symfony-version }}
# This is needed to fix builds on Symfony 5.4 where the `annotation_reader` service may not be set up if the Annotations package is not in the production dependencies
- name: Move Annotations to require
run: composer require --no-update "doctrine/annotations:^1.8.0|^2.0"
- name: Install Composer dependencies
if: matrix.composer-flags == ''
run: composer install
- name: Install Composer dependencies with options
if: matrix.composer-flags != ''
run: composer ${{ matrix.composer-flags }}
- name: Show Composer dependencies
run: composer show
- name: Run tests
# In phpunit.xml.dist, tests annotated with "@group mysql" are excluded, revert this
# Run tests twice to ensure that tests are idempotent even if database caching is enabled
run: |
php ./vendor/bin/phpunit --testdox --exclude-group ""
php ./vendor/bin/phpunit --testdox --exclude-group ""