From cccef95f76699288cd33bc81349d746418d691a9 Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Tue, 10 Sep 2024 23:44:19 -0300 Subject: [PATCH 1/3] WIP: issue-1162 From 9f2b5668c4cee3a6907d1a6b71f9b76c69bc258d Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:02:14 -0300 Subject: [PATCH 2/3] Changes to support PHP 8.3 --- .deployignore | 1 + .distignore | 1 + .github/workflows/phpcs.yml | 2 +- .github/workflows/phpunit.yml | 6 +++- .phpcs.xml | 56 +++++++++++++++++------------------ .phpunit-watcher.yml | 6 ++++ apple-news.php | 10 ++----- phpunit.xml.dist | 30 +++++++++---------- 8 files changed, 60 insertions(+), 52 deletions(-) create mode 100644 .phpunit-watcher.yml diff --git a/.deployignore b/.deployignore index 3b672fd8..4aca9dbd 100644 --- a/.deployignore +++ b/.deployignore @@ -20,6 +20,7 @@ vendor .eslintrc.json .gitignore .nvmrc +.phpunit-watcher.yml .phpcs.xml .phpcs-cache.json .phpunit.result.cache diff --git a/.distignore b/.distignore index 74c1abc2..1bbe998b 100644 --- a/.distignore +++ b/.distignore @@ -21,6 +21,7 @@ vendor .gitignore .nvmrc .phpcs.xml +.phpunit-watcher.yml .phpcs-cache.json .phpunit.result.cache babel.config.json diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 1380f48f..8e988688 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -15,7 +15,7 @@ jobs: phpcs: strategy: matrix: - php: [ 8.2 ] + php: [ '8.3' ] if: github.event.pull_request.draft == false uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main with: diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 60f771d5..1491b213 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -16,8 +16,12 @@ jobs: strategy: matrix: multisite: [true, false] - php: ['8.2', '8.1', '8.0'] + php: ['8.3', '8.2', '8.1', '8.0'] wordpress: ["latest"] + include: + - php: '8.0' + wordpress: '6.3' + multisite: false if: github.event.pull_request.draft == false uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main with: diff --git a/.phpcs.xml b/.phpcs.xml index a03a8abc..d08ba247 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -5,9 +5,36 @@ - + + + + + + + + + + + + + + + + + + + + + build/ + node_modules/ + vendor/ + @@ -43,31 +70,4 @@ tests/ - - - - - - - - - - - - - - - - - - build/ - node_modules/ - vendor/ - - - diff --git a/.phpunit-watcher.yml b/.phpunit-watcher.yml new file mode 100644 index 00000000..ee414c08 --- /dev/null +++ b/.phpunit-watcher.yml @@ -0,0 +1,6 @@ +watch: + directories: + - tests + - admin + - includes + fileMask: '*.php' diff --git a/apple-news.php b/apple-news.php index 090ed089..e3bab4c1 100644 --- a/apple-news.php +++ b/apple-news.php @@ -51,9 +51,9 @@ function apple_news_date( $format, $timestamp = null, $timezone = null ) { */ function apple_news_activate_wp_plugin() { // Check for PHP version. - if ( version_compare( PHP_VERSION, '5.3.6' ) < 0 ) { + if ( version_compare( PHP_VERSION, '8.0.0' ) < 0 ) { deactivate_plugins( basename( __FILE__ ) ); - wp_die( esc_html__( 'This plugin requires at least PHP 5.3.6', 'apple-news' ) ); + wp_die( esc_html__( 'This plugin requires at least PHP 8.0.0', 'apple-news' ) ); } } @@ -194,9 +194,5 @@ function apple_news_is_classic_editor_plugin_active() { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } - if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) { - return true; - } - - return false; + return is_plugin_active( 'classic-editor/classic-editor.php' ); } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8633eee9..930d2f0a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,17 @@ - - - - - - ./tests/ - - + bootstrap="tests/bootstrap.php" + backupGlobals="false" + colors="true" + convertDeprecationsToExceptions="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true"> + + + + + + ./tests/ + + From f07dd541b64c61b3ff99304e88fd274438944ab7 Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:02:39 -0300 Subject: [PATCH 3/3] Ready for review