diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index d4b6317..b8b0af0 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -47,7 +47,7 @@ jobs: - name: Setup PHP version uses: shivammathur/setup-php@v2 with: - php-version: '7.1' + php-version: '7.2' extensions: simplexml, mysql tools: phpunit-polyfills - name: Checkout source code @@ -69,4 +69,4 @@ jobs: - name: Install composer run: composer install --prefer-dist --no-progress --no-suggest - name: Run phpunit - run: phpunit + run: composer run-script phpunit diff --git a/.gitignore b/.gitignore index fab41ab..48ff83e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ assets/js/build languages/neve-fse.pot .DS_Store +.phpunit.result.cache diff --git a/composer.json b/composer.json index ae2652e..b303f96 100644 --- a/composer.json +++ b/composer.json @@ -51,6 +51,7 @@ "format": "phpcbf --standard=phpcs.xml --report-summary --report-source -s --runtime-set testVersion 7.0- ", "phpcs": "phpcs --standard=phpcs.xml -s --runtime-set testVersion 7.0-", "lint": "composer run-script phpcs", - "phpcs-i": "phpcs -i" + "phpcs-i": "phpcs -i", + "phpunit": "phpunit" } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6f688bf..cf809b1 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -8,6 +8,11 @@ define( 'NEVE_FSE_IGNORE_SOURCE_CHECK', true ); $_tests_dir = getenv( 'WP_TESTS_DIR' ); + +if ( class_exists( '\Yoast\PHPUnitPolyfills\Autoload' ) === false ) { + require_once dirname( dirname( __FILE__ ) ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php'; +} + if ( ! $_tests_dir ) { $_tests_dir = '/tmp/wordpress-tests-lib'; }