diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..0084dcceea6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + php: [8.1] + db_image_name: [mysql, percona, postgres] + include: + - db_image_name: mysql + db_image_version: 8 + db: mysql + vars: '-e MYSQL_PASSWORD=myPassword -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=u_doctrine_extensions -e MYSQL_ROOT_PASSWORD=myPassword' + db_port: 3306 + health: '--health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10' + - db_image_name: percona + db_image_version: 8 + db: mysql + vars: '-e MYSQL_PASSWORD=myPassword -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=u_doctrine_extensions -e MYSQL_ROOT_PASSWORD=myPassword' + db_port: 3306 + health: '--health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10' + - db_image_name: postgres + db_image_version: 15 + db: pgsql + vars: '-e POSTGRES_DB=doctrine_extensions_tests -e POSTGRES_USER=u_doctrine_extensions -e POSTGRES_PASSWORD=myPassword' + health: '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5' + db_port: 5432 + + services: + database: + image: ${{ matrix.db_image_name }}:${{ matrix.db_image_version }} + ports: + - ${{ matrix.db_port }}:${{ matrix.db_port }} + options: >- + ${{ matrix.vars }} + ${{ matrix.health }} + + steps: + - uses: actions/checkout@v3 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql, pdo_pgsql + coverage: none + + - name: Install dependencies + run: | + composer self-update + composer install --prefer-dist --optimize-autoloader --no-interaction --no-suggest + + - name: Run setup tests + run: vendor/bin/phpunit --configuration tests/config/${{ matrix.db }}.phpunit.xml tests/Oro/Tests/Connection/SetupTest.php + + - name: Run test suite + run: vendor/bin/phpunit --configuration tests/config/${{ matrix.db }}.phpunit.xml --testsuite="Oro Doctrine Extensions Test Suite" + + - name: Check code style + run: vendor/bin/phpcs src/ tests/ -p --encoding=utf-8 --extensions=php --standard=psr2 + + - name: Tear down tests + run: vendor/bin/phpunit --configuration tests/config/${{ matrix.db }}.phpunit.xml tests/Oro/Tests/Connection/TearDownTest.php \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c4d9a8fa86e..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -os: linux -dist: xenial -language: php - -jobs: - include: - - php: 7.3 - env: DB=mysql DB_IMAGE=mysql:8.0.3 VARS='-p 33060:3306 -e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ALLOW_EMPTY_PASSWORD=yes' - - php: 7.4 - env: DB=mysql DB_IMAGE=mysql:8.0.3 VARS='-p 33060:3306 -e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ALLOW_EMPTY_PASSWORD=yes' - - - php: 7.3 - env: DB=mysql DB_IMAGE=mariadb:10.1 VARS='-p 33060:3306 -e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ALLOW_EMPTY_PASSWORD=yes' - - php: 7.4 - env: DB=mysql DB_IMAGE=mariadb:10.1 VARS='-p 33060:3306 -e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ALLOW_EMPTY_PASSWORD=yes' - - - php: 7.3 - env: DB=mysql DB_IMAGE=percona:5.7 VARS='-p 33060:3306 -e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ALLOW_EMPTY_PASSWORD=yes' - - php: 7.4 - env: DB=mysql DB_IMAGE=percona:5.7 VARS='-p 33060:3306 -e MYSQL_PASSWORD=travis -e MYSQL_DATABASE=doctrine_extensions_tests -e MYSQL_USER=travis -e MYSQL_ALLOW_EMPTY_PASSWORD=yes' - - - php: 7.3 - env: DB=pgsql DB_IMAGE=postgres:9.6 VARS='-p 54320:5432 -e POSTGRES_DB=doctrine_extensions_tests -e POSTGRES_USER=travis -e POSTGRES_PASSWORD=travis' - - php: 7.4 - env: DB=pgsql DB_IMAGE=postgres:9.6 VARS='-p 54320:5432 -e POSTGRES_DB=doctrine_extensions_tests -e POSTGRES_USER=travis -e POSTGRES_PASSWORD=travis' - -install: - - composer self-update - - composer install --prefer-dist --optimize-autoloader --no-interaction --no-suggest - - docker pull ${DB_IMAGE} - - docker run -d --name database ${VARS} ${DB_IMAGE} - - sleep 30s - -before_script: - - vendor/bin/phpunit --configuration tests/config/$DB.phpunit.xml tests/Oro/Tests/Connection/SetupTest.php - -script: - - vendor/bin/phpunit --configuration tests/config/$DB.phpunit.xml --testsuite="Oro Doctrine Extensions Test Suite" - - vendor/bin/phpcs src/ tests/ -p --encoding=utf-8 --extensions=php --standard=psr2 - -after_success: - - vendor/bin/phpunit --configuration tests/config/$DB.phpunit.xml tests/Oro/Tests/Connection/TearDownTest.php diff --git a/src/Oro/ORM/Query/AST/FunctionFactory.php b/src/Oro/ORM/Query/AST/FunctionFactory.php index cbf62562f11..ca8bef268b2 100644 --- a/src/Oro/ORM/Query/AST/FunctionFactory.php +++ b/src/Oro/ORM/Query/AST/FunctionFactory.php @@ -16,8 +16,11 @@ class FunctionFactory * * @throws QueryException */ - public static function create(AbstractPlatform $platform, string $functionName, array $parameters): PlatformFunctionNode - { + public static function create( + AbstractPlatform $platform, + string $functionName, + array $parameters + ): PlatformFunctionNode { if ($platform instanceof PostgreSQLPlatform) { $platformName = 'postgresql'; } elseif ($platform instanceof MySQLPlatform) { diff --git a/tests/config/mysql.phpunit.xml b/tests/config/mysql.phpunit.xml index d8e106eb0db..bb77b059e28 100644 --- a/tests/config/mysql.phpunit.xml +++ b/tests/config/mysql.phpunit.xml @@ -3,10 +3,10 @@ - - + + - + diff --git a/tests/config/pgsql.phpunit.xml b/tests/config/pgsql.phpunit.xml index 939e9d7a736..0ac03db90f2 100644 --- a/tests/config/pgsql.phpunit.xml +++ b/tests/config/pgsql.phpunit.xml @@ -2,11 +2,11 @@ - - - + + + - +