Skip to content

Commit c4b4a6b

Browse files
committed
fix: phpunit gh action failing
1 parent 7abff52 commit c4b4a6b

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.github/workflows/test-php.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Setup PHP version
4848
uses: shivammathur/setup-php@v2
4949
with:
50-
php-version: '7.1'
50+
php-version: '7.2'
5151
extensions: simplexml, mysql
5252
tools: phpunit-polyfills
5353
- name: Checkout source code
@@ -69,4 +69,4 @@ jobs:
6969
- name: Install composer
7070
run: composer install --prefer-dist --no-progress --no-suggest
7171
- name: Run phpunit
72-
run: phpunit
72+
run: composer run-script phpunit

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ assets/js/build
1313
languages/fork.pot
1414

1515
.DS_Store
16+
phpunit.result.cache

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"format": "phpcbf --standard=phpcs.xml --report-summary --report-source -s --runtime-set testVersion 7.0- ",
5252
"phpcs": "phpcs --standard=phpcs.xml -s --runtime-set testVersion 7.0-",
5353
"lint": "composer run-script phpcs",
54-
"phpcs-i": "phpcs -i"
54+
"phpcs-i": "phpcs -i",
55+
"phpunit": "phpunit"
5556
}
5657
}

tests/bootstrap.php

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
define( 'FORK_IGNORE_SOURCE_CHECK', true );
99

1010
$_tests_dir = getenv( 'WP_TESTS_DIR' );
11+
12+
if ( class_exists( '\Yoast\PHPUnitPolyfills\Autoload' ) === false ) {
13+
require_once dirname( dirname( __FILE__ ) ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
14+
}
15+
1116
if ( ! $_tests_dir ) {
1217
$_tests_dir = '/tmp/wordpress-tests-lib';
1318
}

0 commit comments

Comments
 (0)