Skip to content

Allow Hash::remove() to remove from ArrayAccess objects #10921

Allow Hash::remove() to remove from ArrayAccess objects

Allow Hash::remove() to remove from ArrayAccess objects #10921

Workflow file for this run

name: CI
on:
push:
branches:
- '4.x'
- '4.next'
- '5.x'
- '5.next'
pull_request:
branches:
- '*'
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
testsuite:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.3']
db-type: [sqlite, pgsql]
prefer-lowest: ['']
include:
- php-version: '8.1'
db-type: 'mariadb'
- php-version: '8.1'
db-type: 'mysql'
prefer-lowest: 'prefer-lowest'
- php-version: '8.2'
db-type: 'mysql'
- php-version: '8.3'
db-type: 'mysql'
services:
redis:
image: redis
ports:
- 6379/tcp
memcached:
image: memcached
ports:
- 11211/tcp
steps:
- name: Setup MySQL latest
if: matrix.db-type == 'mysql'
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin
- name: Setup PostgreSQL latest
if: matrix.db-type == 'pgsql'
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres
- uses: getong/mariadb-action@v1.1
if: matrix.db-type == 'mariadb'
with:
mysql database: 'cakephp'
mysql root password: 'root'
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl-72.1, apcu, memcached, redis, pdo_${{ matrix.db-type }}
ini-values: apc.enable_cli = 1, zend.assertions = 1
coverage: pcov
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Get date part for cache key
id: key-date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
- name: Install packages
run: |
sudo locale-gen da_DK.UTF-8
sudo locale-gen de_DE.UTF-8
- name: Composer install
run: |
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
composer update --prefer-lowest --prefer-stable
else
composer update
fi
- name: Setup problem matchers for PHPUnit
if: matrix.php-version == '8.1' && matrix.db-type == 'mysql'
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Wait for MySQL
if: matrix.db-type == 'mysql' || matrix.db-type == 'mariadb'
run: while ! `mysqladmin ping -h 127.0.0.1 --silent`; do printf 'Waiting for MySQL...\n'; sleep 2; done;
- name: Run PHPUnit
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
run: |
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp'; fi
if [[ ${{ matrix.db-type }} == 'mariadb' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp'; fi
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
export CODECOVERAGE=1
vendor/bin/phpunit --display-incomplete --display-skipped --coverage-clover=coverage.xml
CAKE_TEST_AUTOQUOTE=1 vendor/bin/phpunit --display-incomplete --display-skipped --testsuite=database
vendor/bin/phpunit --display-incomplete --display-skipped --testsuite=globalfunctions --coverage-clover=coverage-functions.xml
else
vendor/bin/phpunit
CAKE_TEST_AUTOQUOTE=1 vendor/bin/phpunit --testsuite=database
fi
- name: Submit code coverage
if: matrix.php-version == '8.1'
uses: codecov/codecov-action@v4
with:
files: coverage.xml,coverage-functions.xml
testsuite-windows:
runs-on: windows-2022
name: Windows - PHP 8.1 & SQL Server
env:
EXTENSIONS: mbstring, intl, apcu, redis, pdo_sqlsrv
PHP_VERSION: '8.1'
steps:
- uses: actions/checkout@v4
- name: Get date part for cache key
id: key-date
run: echo "date=$(date +'%Y-%m')" >> $env:GITHUB_OUTPUT
- name: Setup PHP extensions cache
id: php-ext-cache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.EXTENSIONS }}
key: ${{ steps.key-date.outputs.date }}
- name: Cache PHP extensions
uses: actions/cache@v4
with:
path: ${{ steps.php-ext-cache.outputs.dir }}
key: ${{ runner.os }}-php-ext-${{ steps.php-ext-cache.outputs.key }}
restore-keys: ${{ runner.os }}-php-ext-${{ steps.php-ext-cache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.EXTENSIONS }}
ini-values: apc.enable_cli = 1, zend.assertions = 1, extension = php_fileinfo.dll
coverage: none
- name: Setup SQLServer
run: |
# MSSQLLocalDB is the default SQL LocalDB instance
SqlLocalDB start MSSQLLocalDB
SqlLocalDB info MSSQLLocalDB
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "create database cakephp;"
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $env:GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
- name: Composer install
run: composer update
- name: Run PHPUnit
env:
DB_URL: 'sqlserver://@(localdb)\MSSQLLocalDB/cakephp'
run: |
set CAKE_DISABLE_GLOBAL_FUNCS=1
vendor/bin/phpunit --display-incomplete --display-skipped
- name: Run PHPUnit (autoquote enabled)
env:
DB_URL: 'sqlserver://@(localdb)\MSSQLLocalDB/cakephp'
run: |
set CAKE_TEST_AUTOQUOTE=1
vendor/bin/phpunit --display-incomplete --display-skipped --testsuite=database
cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-22.04
env:
PHIVE_KEYS: 'CF1A108D0E7AE720,51C67305FFC2E5C0,12CE0F1D262429A5'
PHPSTAN_TESTS: 1
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl
coverage: none
tools: phive, cs2pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Composer install
uses: ramsey/composer-install@v3
- name: Install PHP tools with phive.
run: 'phive install --trust-gpg-keys "$PHIVE_KEYS"'
- name: Run phpcs
if: always()
run: vendor/bin/phpcs --report=checkstyle | cs2pr
- name: Run psalm
if: always()
run: tools/psalm --output-format=github
- name: Run phpstan
if: always()
run: vendor/bin/phpstan analyse --error-format=github
- name: Run phpstan for tests
if: env.PHPSTAN_TESTS
run: vendor/bin/phpstan analyse -c tests/phpstan.neon --error-format=github
- name: Run class deprecation aliasing validation script
if: always()
run: php contrib/validate-deprecation-aliases.php
- name: Run composer.json validation for split packages
if: always()
run: php contrib/validate-split-packages.php
- name: Run PHPStan for split packages
if: always()
run: php contrib/validate-split-packages-phpstan.php
- name: Prefer lowest check
if: matrix.prefer-lowest == 'prefer-lowest'
run: composer require --dev dereuromark/composer-prefer-lowest && vendor/bin/validate-prefer-lowest -m