Skip to content

Commit

Permalink
feat: Upgrade Timber requirements and testing (PHP 8.1/WP 6.2/Twig 3.…
Browse files Browse the repository at this point in the history
…5) (#2970)

- PHP >=8.1
- WP >=6.2
- Twig >= 3.5
- Remove symfony/polyfill-php80
- Bump integration plugin versions
- Update workflow matrix accordingly
  • Loading branch information
nlemoine committed Apr 26, 2024
1 parent e40ceb3 commit a2f0f07
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 32 deletions.
25 changes: 2 additions & 23 deletions .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,14 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2']
wp: ['latest', '5.3']
php: ['8.1', '8.2']
wp: ['latest', '6.2']
multisite: ['0', '1']
dependency-version: ['highest', 'lowest']
webp: [false]
coverage: [false]
extensions: ['gd']
experimental: [false]
exclude:
- wp: '5.3'
php: '8.0'
- wp: '5.3'
php: '8.1'
- wp: '5.3'
php: '8.2'
include:
# PHP 8.2 / experimental
- php: '8.2'
Expand Down Expand Up @@ -122,20 +115,6 @@ jobs:
with:
dependency-versions: ${{ matrix.dependency-version }}

- name: Upgrade dev dependencies when lowest
if: matrix.dependency-version == 'lowest'
run: |
composer update yoast/wp-test-utils -W --dev
composer update composer/installers -W
- name: Downgrade PHPUnit to ^7.5 when WP < 5.9
if: matrix.wp < '5.9'
run: composer req phpunit/phpunit:^7.5 yoast/wp-test-utils:^1.0 -W --dev

- name: Upgrade PHPUnit to ^9.0 when prefer lowest and PHP 8.0+
if: ${{ matrix.dependency-version == 'prefer-lowest' && matrix.php >= '8.0' }}
run: composer req phpunit/phpunit:^9.0 yoast/wp-test-utils:^1.0 -W --dev

- name: Install tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,25 @@
"docs": "https://timber.github.io/docs/"
},
"require": {
"php": "^7.4 || ^8.0",
"composer/installers": "^1.0 || ^2.0",
"symfony/polyfill-php80": "^1.27",
"twig/twig": "^2.15.3 || ^3.0"
"php": "^8.1",
"twig/twig": "^3.5"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.28",
"php-parallel-lint/php-parallel-lint": "^1.3",
"php-stubs/acf-pro-stubs": "^6.0",
"php-stubs/wp-cli-stubs": "^2.0",
"phpro/grumphp": "^1.12",
"phpro/grumphp": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.7",
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "^3.0",
"symplify/easy-coding-standard": "^12.0",
"szepeviktor/phpstan-wordpress": "^1.1",
"twig/cache-extra": "^3.3",
"wpackagist-plugin/advanced-custom-fields": "^5.0 || ^6.0",
"wpackagist-plugin/co-authors-plus": "^3.3",
"yoast/wp-test-utils": "^1.0"
"wpackagist-plugin/advanced-custom-fields": "^6.0",
"wpackagist-plugin/co-authors-plus": "^3.6",
"yoast/wp-test-utils": "^1.2"
},
"suggest": {
"php-coveralls/php-coveralls": "^2.0 for code coverage",
Expand Down Expand Up @@ -101,7 +100,8 @@
"ergebnis/composer-normalize": true,
"phpro/grumphp": true,
"phpstan/extension-installer": true
}
},
"sort-packages": true
},
"scripts": {
"analyze": "phpstan analyse --memory-limit=1G",
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ function wpml_object_id_filter($element_id, $element_type = 'post', $return_orig

WP_CLI::set_logger(new WpCliLogger(false));

error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);

/*
* Bootstrap WordPress. This will also load the Composer autoload file, the PHPUnit Polyfills
* and the custom autoloader for the TestCase and the mock object classes.
Expand Down

0 comments on commit a2f0f07

Please sign in to comment.