diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 4c249687b0..9b2460f583 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -37,24 +37,56 @@ on: - reopened - synchronize +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: php-test: - name: PHP + name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}${{ matrix.experimental && ' (experimental)' || '' }} runs-on: ubuntu-latest timeout-minutes: 20 + strategy: + fail-fast: true + matrix: + php: + - '7.0' + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + - '8.2' + wordpress: [ 'latest' ] + include: + - php: '8.2' + wordpress: 'trunk' + experimental: true + env: + WP_ENV_PHP_VERSION: ${{ matrix.php }} + WP_ENV_CORE: ${{ matrix.wordpress == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }} steps: - - uses: styfle/cancel-workflow-action@0.11.0 - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Setup Node.js (.nvmrc) uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' cache: npm + - name: npm install run: npm ci + - name: Install WordPress run: npm run wp-env start - - name: Running single site unit tests + + - name: Running php unit tests run: npm run test-php + - name: Running multisite unit tests run: npm run test-php-multisite diff --git a/composer.json b/composer.json index 8ddca6af09..07bea23199 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "squizlabs/php_codesniffer": "^3.5", "szepeviktor/phpstan-wordpress": "^1.3.0", "wp-coding-standards/wpcs": "^3.0.0", - "wp-phpunit/wp-phpunit": "^5.8", + "wp-phpunit/wp-phpunit": "^6.1", "yoast/phpunit-polyfills": "^1.0", "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-deprecation-rules": "^1.1", diff --git a/composer.lock b/composer.lock index 59e7347f06..cac2508a87 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8afb8511538e46c6875a017b72ad8711", + "content-hash": "a54920b7423a06da2fc02c39c97feb5e", "packages": [ { "name": "composer/installers", @@ -532,16 +532,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.3.0", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "adda7609e71d5f4dc7b87c74f8ec9e3437d2e92c" + "reference": "f22b00cacd3b9addc2b07ff48290084503c48574" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/adda7609e71d5f4dc7b87c74f8ec9e3437d2e92c", - "reference": "adda7609e71d5f4dc7b87c74f8ec9e3437d2e92c", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/f22b00cacd3b9addc2b07ff48290084503c48574", + "reference": "f22b00cacd3b9addc2b07ff48290084503c48574", "shasum": "" }, "require-dev": { @@ -554,6 +554,7 @@ }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" }, "type": "library", @@ -570,9 +571,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.3.0" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.3.2" }, - "time": "2023-08-10T16:34:11+00:00" + "time": "2023-10-14T10:08:05+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -865,16 +866,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.38", + "version": "1.10.39", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d9dedb0413f678b4d03cbc2279a48f91592c97c4", + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4", "shasum": "" }, "require": { @@ -923,7 +924,7 @@ "type": "tidelift" } ], - "time": "2023-10-06T14:19:14+00:00" + "time": "2023-10-17T15:46:26+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -2614,22 +2615,22 @@ }, { "name": "szepeviktor/phpstan-wordpress", - "version": "v1.3.0", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/szepeviktor/phpstan-wordpress.git", - "reference": "5b5cc77ed51fdaf64efe3f00b5aae4b709d2cfa9" + "reference": "b8516ed6bab7ec50aae981698ce3f67f1be2e45a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/5b5cc77ed51fdaf64efe3f00b5aae4b709d2cfa9", - "reference": "5b5cc77ed51fdaf64efe3f00b5aae4b709d2cfa9", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/b8516ed6bab7ec50aae981698ce3f67f1be2e45a", + "reference": "b8516ed6bab7ec50aae981698ce3f67f1be2e45a", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", - "phpstan/phpstan": "^1.10.0", + "phpstan/phpstan": "^1.10.30", "symfony/polyfill-php73": "^1.12.0" }, "require-dev": { @@ -2640,6 +2641,9 @@ "phpunit/phpunit": "^8.0 || ^9.0", "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" }, + "suggest": { + "swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods" + }, "type": "phpstan-extension", "extra": { "phpstan": { @@ -2667,9 +2671,9 @@ ], "support": { "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", - "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.0" + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.2" }, - "time": "2023-04-23T06:15:06+00:00" + "time": "2023-10-16T17:23:56+00:00" }, { "name": "theseer/tokenizer", @@ -2789,16 +2793,16 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.9.7", + "version": "6.3.1", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "f9b5b3a44d3677c7d4803074d81ad3cd12b0eeea" + "reference": "4797791a311c41d213027333e4fcc48073f77df0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/f9b5b3a44d3677c7d4803074d81ad3cd12b0eeea", - "reference": "f9b5b3a44d3677c7d4803074d81ad3cd12b0eeea", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/4797791a311c41d213027333e4fcc48073f77df0", + "reference": "4797791a311c41d213027333e4fcc48073f77df0", "shasum": "" }, "type": "library", @@ -2833,7 +2837,7 @@ "issues": "https://github.com/wp-phpunit/issues", "source": "https://github.com/wp-phpunit/wp-phpunit" }, - "time": "2022-08-30T21:14:52+00:00" + "time": "2023-08-09T01:26:57+00:00" }, { "name": "yoast/phpunit-polyfills",