From 1d5fbc49911aa21a8b642d0f6f671f918426a90f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Feb 2022 23:20:11 +0000 Subject: [PATCH 001/299] Bump simple-get from 3.1.0 to 3.1.1 Bumps [simple-get](https://github.com/feross/simple-get) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/feross/simple-get/releases) - [Commits](https://github.com/feross/simple-get/compare/v3.1.0...v3.1.1) --- updated-dependencies: - dependency-name: simple-get dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 384f2af5d..9a7d2248f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8850,9 +8850,9 @@ simple-concat@^1.0.0: integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== simple-get@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3" - integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== + version "3.1.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.1.tgz#cc7ba77cfbe761036fbfce3d021af25fc5584d55" + integrity sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA== dependencies: decompress-response "^4.2.0" once "^1.3.1" From 75c02e10e64037e43c265241ecd8ffbbadb9b374 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Jul 2022 09:46:51 +0000 Subject: [PATCH 002/299] Bump terser from 4.8.0 to 4.8.1 Bumps [terser](https://github.com/terser/terser) from 4.8.0 to 4.8.1. - [Release notes](https://github.com/terser/terser/releases) - [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md) - [Commits](https://github.com/terser/terser/commits) --- updated-dependencies: - dependency-name: terser dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index a42d06050..74ad5f101 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2555,9 +2555,9 @@ buffer-fill@^1.0.0: integrity sha1-+PeLdniYiO858gXNY39o5wISKyw= buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== buffer-xor@^1.0.3: version "1.0.3" @@ -8974,9 +8974,9 @@ source-map-support@^0.4.15: source-map "^0.5.6" source-map-support@~0.5.12: - version "0.5.19" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" - integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -9412,9 +9412,9 @@ terser-webpack-plugin@^1.4.3: worker-farm "^1.7.0" terser@^4.1.2: - version "4.8.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" - integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== + version "4.8.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.1.tgz#a00e5634562de2239fd404c649051bf6fc21144f" + integrity sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw== dependencies: commander "^2.20.0" source-map "~0.6.1" From adb9e803c225c9be9a76e1ae09d0a62f3f94c3ed Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 27 Jul 2022 10:37:38 +0200 Subject: [PATCH 003/299] Add five checkboxes about relevant testing scenarios --- .github/PULL_REQUEST_TEMPLATE.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ffc806376..8771cc54a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -32,11 +32,21 @@ This PR can be acceptance tested by following these steps: * +#### Relevant test scenarios +* [ ] Changes should be tested with the browser console open +* [ ] Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies +* [ ] Changes should be tested on different editors (Block/Classic/Elementor/other) +* [ ] Changes should be tested on different browsers +* [ ] Changes should be tested on multisite + ### Test instructions for QA when the code is in the RC * [ ] QA should use the same steps as above. From ccc09cbe956b2c2eadb027f01ad94092ad880d43 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 29 Jul 2022 11:20:38 +0200 Subject: [PATCH 004/299] Set minimum WP version to 5.9 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 8997254c2..7e88a21dd 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: yoast, lopo Donate link: https://yoast.com/wordpress/plugins/duplicate-post/ Tags: duplicate post, copy, clone -Requires at least: 5.8 +Requires at least: 5.9 Tested up to: 6.0 Stable tag: 4.5 Requires PHP: 5.6.20 From 470b28470731b8a0d8a01f7835a210a9bf9a69eb Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 26 Jul 2022 23:04:21 +0200 Subject: [PATCH 005/299] GH Actions: minor tweak Ensure that `coverage: none` is always used (except for when running Coverage) as it prevents problems with undesired extensions being installed/incorrectly configured. --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7c6434c6b..25115dee8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -61,6 +61,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 5.6 + coverage: none # This action also handles the caching of the Yarn dependencies. # https://github.com/actions/setup-node From 572a21a54b18c1064c051cf308d71e0c75d1640c Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 26 Jul 2022 23:12:49 +0200 Subject: [PATCH 006/299] QA: fix incorrect escaping function --- src/admin/views/options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/admin/views/options.php b/src/admin/views/options.php index 714127c2c..9a7b02f11 100644 --- a/src/admin/views/options.php +++ b/src/admin/views/options.php @@ -244,7 +244,7 @@ class="nav-tab"

- +

From 71bdf3c34404fe97f295197a565e91f9d223f213 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 3 Aug 2022 19:05:04 +0200 Subject: [PATCH 007/299] Add dependabot configuration file This commit adds an initial Dependabot configuration to: * Submit pull requests for security updates and version updates for GH Action runner dependencies. At a later point in time, we could consider enabling it for Composer dependencies as well. The configuration has been set up to: * Run weekly (for now). * Submit a maximum of 5 pull requests at a time. If additional pull requests are needed, these will subsequently be submitted the next time Dependabot runs after one or more of the open pull requests have been merged. * The commit messages for PRs submitted by Dependabot will be prefixed according the unofficial conventions used in this repo up to now. * The PRs will automatically be labelled with an appropriate label as already in use in this repo. Refs: * https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file * https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#versioning-strategy --- .github/dependabot.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..50e0ff7ad --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +# Dependabot configuration. +# +# Please see the documentation for all configuration options: +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + # Maintain dependencies for GitHub Actions. + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 + commit-message: + prefix: "GH Actions:" + labels: + - "changelog: non-user-facing" + - "yoast cs/qa" From 5719aa3081f9b383ac42815d89b83fb2649e8134 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Aug 2022 02:26:01 +0000 Subject: [PATCH 008/299] Bump moment-timezone from 0.5.31 to 0.5.37 Bumps [moment-timezone](https://github.com/moment/moment-timezone) from 0.5.31 to 0.5.37. - [Release notes](https://github.com/moment/moment-timezone/releases) - [Changelog](https://github.com/moment/moment-timezone/blob/develop/changelog.md) - [Commits](https://github.com/moment/moment-timezone/compare/0.5.31...0.5.37) --- updated-dependencies: - dependency-name: moment-timezone dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index a42d06050..762aee672 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6661,16 +6661,16 @@ mkdirp@~1.0.4: integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== moment-timezone@^0.5.31: - version "0.5.31" - resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.31.tgz#9c40d8c5026f0c7ab46eda3d63e49c155148de05" - integrity sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA== + version "0.5.37" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.37.tgz#adf97f719c4e458fdb12e2b4e87b8bec9f4eef1e" + integrity sha512-uEDzDNFhfaywRl+vwXxffjjq1q0Vzr+fcQpQ1bU0kbzorfS7zVtZnCnGc8mhWmF39d4g4YriF6kwA75mJKE/Zg== dependencies: moment ">= 2.9.0" "moment@>= 2.9.0", moment@>=1.6.0, moment@^2.22.1: - version "2.29.1" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" - integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== + version "2.29.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== mousetrap@^1.6.5: version "1.6.5" From e26514034668b2c60acc54987c8c4248cd9f2680 Mon Sep 17 00:00:00 2001 From: Jannes Date: Thu, 29 Sep 2022 14:29:39 +0200 Subject: [PATCH 009/299] Rename relevant master references to main --- .github/workflows/cs.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index d294c4e25..fb87305c7 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -1,10 +1,10 @@ name: CS on: - # Run on all pushes (except to master) and on all pull requests. + # Run on all pushes (except to main) and on all pull requests. push: branches-ignore: - - 'master' + - 'main' pull_request: # Allow manually triggering the workflow. workflow_dispatch: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e1ec3d2a2..6ae316100 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,7 +4,7 @@ on: # Run on pushes to select branches and on all pull requests. push: branches: - - master + - main - trunk - 'release/**' - 'hotfix/[0-9]+.[0-9]+*' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b022494ca..f90be8d13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: # Run on pushes to select branches and on all pull requests. push: branches: - - master + - main - trunk - 'release/**' - 'hotfix/[0-9]+.[0-9]+*' From 82dd5ffbf18df04b73cff357ee0d62576d894172 Mon Sep 17 00:00:00 2001 From: noud-github Date: Tue, 4 Oct 2022 07:52:49 +0200 Subject: [PATCH 010/299] preparre for rename masin to master yoast-dist --- .github/workflows/deploy.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 25115dee8..c19943fec 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,7 +43,7 @@ concurrency: env: DIST_ORG: 'Yoast-dist' - DIST_DEFAULT_BRANCH: 'master' + DIST_DEFAULT_BRANCH: 'main' jobs: prepare: diff --git a/README.md b/README.md index 003aa2f86..4b0c0354d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This document addresses the GitHub repository. WordPress.org uses the [readme.tx ### Install using zipfile -1. Download the archive from https://wordpress.org/plugins/duplicate-post/ (latest stable) or the [latest snapshot ZIP](https://github.com/Yoast/duplicate-post/archive/master.zip) from GitHub; +1. Download the archive from https://wordpress.org/plugins/duplicate-post/ (latest stable) or the [latest snapshot ZIP](https://github.com/Yoast/duplicate-post/archive/main.zip) from GitHub; 2. Unzip the archive on your computer; 3. Upload the `duplicate-post` directory into the `/wp-content/plugins/` directory; 4. Activate the plugin through the _Plugins_ page in WordPress Dashboard; From 49c05da69d034e0a8fbe5106d3f2ee5c6658ec69 Mon Sep 17 00:00:00 2001 From: Lars van Rhijn Date: Wed, 19 Oct 2022 11:36:23 +0200 Subject: [PATCH 011/299] Remove call to deprecated duplicate_post_blacklist_filter filter --- admin-functions.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/admin-functions.php b/admin-functions.php index 3bc756928..e4fde243b 100644 --- a/admin-functions.php +++ b/admin-functions.php @@ -344,8 +344,6 @@ function duplicate_post_copy_post_meta_info( $new_id, $post ) { $meta_blacklist[] = '_thumbnail_id'; } - $meta_blacklist = apply_filters_deprecated( 'duplicate_post_blacklist_filter', [ $meta_blacklist ], '3.2.5', 'duplicate_post_excludelist_filter' ); - /** * Filters the meta fields excludelist when copying a post. * From 43005e79fa5424b1177e9395ed7ca4de78b328a9 Mon Sep 17 00:00:00 2001 From: Irene Date: Wed, 26 Oct 2022 12:11:22 +0200 Subject: [PATCH 012/299] Set tested up to version to 6.1 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 7e88a21dd..9893826d1 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: yoast, lopo Donate link: https://yoast.com/wordpress/plugins/duplicate-post/ Tags: duplicate post, copy, clone Requires at least: 5.9 -Tested up to: 6.0 +Tested up to: 6.1 Stable tag: 4.5 Requires PHP: 5.6.20 License: GPLv2 or later From d40128a331fd4bf9ba8459b21a97c2300a2cd44e Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 3 Nov 2022 11:43:46 +0100 Subject: [PATCH 013/299] change log format --- config/grunt/task-config/update-changelog-to-latest.js | 8 ++++---- readme.txt | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index 2dc755e33..331353626 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -12,10 +12,10 @@ module.exports = { readmeFile: "./readme.txt", releaseInChangelog: /[=] \d+\.\d+(\.\d+)? =/g, matchChangelogHeader: /[=]= Changelog ==\n\n/ig, - newHeadertemplate: "== Changelog ==\n\n" + "= " + "VERSIONNUMBER" + " =\nRelease Date: " + "DATESTRING" + "\n\n", - matchCorrectHeader: "= " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\w\+?:\\n|= \\d+[\.\\d]+ =|= Earlier versions =))", - matchCorrectLines: "= " + "VERSIONNUMBER" + "(.|\\n)*?(?=(= \\d+[\.\\d]+ =|= Earlier versions =))", - matchCleanedChangelog: "= " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", + newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease Date: " + "DATESTRING" + "\n\n", + matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\w\+?:\\n|= \\d+[\.\\d]+ =|= Earlier versions =))", + matchCorrectLines: "## " + "VERSIONNUMBER" + "(.|\\n)*?(?=(= \\d+[\.\\d]+ =|= Earlier versions =))", + matchCleanedChangelog: "## " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", replaceCleanedChangelog: "= Earlier versions =", pluginSlug: "duplicate-post", defaultChangelogEntries: "", diff --git a/readme.txt b/readme.txt index 9893826d1..2f0c7c975 100644 --- a/readme.txt +++ b/readme.txt @@ -71,7 +71,8 @@ If Duplicate Post is still in English, or if there are some untranslated strings == Changelog == -= 4.5 = +## 4.5 + Release Date: June 28th, 2022 Enhancements: @@ -86,7 +87,8 @@ Other: * Sets the WordPress tested up to version to 6.0. -= 4.4 = +## 4.4 + Release Date: January 25th, 2022 Enhancements: From 4ba3811f09badb0e000dd032d781f445318f45d9 Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 3 Nov 2022 11:45:03 +0100 Subject: [PATCH 014/299] change change log format and comment --- config/grunt/task-config/update-changelog-to-latest.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index 331353626..f4ca4510e 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -5,7 +5,8 @@ module.exports = { "duplicate-post": { options: { // header: - // = 15.7 = + // ## 15.7 + // // Release Date: January 26th, 2021 // // Enhancements: From cf56be8c8c3c96970af7be6276fead5650a9bc92 Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 3 Nov 2022 11:59:42 +0100 Subject: [PATCH 015/299] remove trailing spaces --- config/grunt/task-config/update-changelog-to-latest.js | 2 +- readme.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index f4ca4510e..b84cf88de 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -21,7 +21,7 @@ module.exports = { pluginSlug: "duplicate-post", defaultChangelogEntries: "", useANewLineAfterHeader: true, - commitChangelog: true, + commitChangelog: false, changelogToInject: ".tmp/n8nchangelog.txt", }, }, diff --git a/readme.txt b/readme.txt index 2f0c7c975..81c4c1c5e 100644 --- a/readme.txt +++ b/readme.txt @@ -71,7 +71,7 @@ If Duplicate Post is still in English, or if there are some untranslated strings == Changelog == -## 4.5 +## 4.5 Release Date: June 28th, 2022 @@ -87,7 +87,7 @@ Other: * Sets the WordPress tested up to version to 6.0. -## 4.4 +## 4.4 Release Date: January 25th, 2022 From 6a33d6a83f67917ea73e41e6517040fbaddd5416 Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 3 Nov 2022 12:51:14 +0100 Subject: [PATCH 016/299] set correct releaseInChangelog --- config/grunt/task-config/update-changelog-to-latest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index b84cf88de..fb98d070a 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -11,9 +11,9 @@ module.exports = { // // Enhancements: readmeFile: "./readme.txt", - releaseInChangelog: /[=] \d+\.\d+(\.\d+)? =/g, + releaseInChangelog: /[#] \d+\.\d+(\.\d+)?\n\n/g, matchChangelogHeader: /[=]= Changelog ==\n\n/ig, - newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease Date: " + "DATESTRING" + "\n\n", + newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease Date: " + "DATESTRING" + "\n", matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\w\+?:\\n|= \\d+[\.\\d]+ =|= Earlier versions =))", matchCorrectLines: "## " + "VERSIONNUMBER" + "(.|\\n)*?(?=(= \\d+[\.\\d]+ =|= Earlier versions =))", matchCleanedChangelog: "## " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", From 4b01cd42d0792d066164f1a53db00fb5211b02e7 Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 3 Nov 2022 13:09:25 +0100 Subject: [PATCH 017/299] set commit changelog to true again --- config/grunt/task-config/update-changelog-to-latest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index fb98d070a..48f609aba 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -21,7 +21,7 @@ module.exports = { pluginSlug: "duplicate-post", defaultChangelogEntries: "", useANewLineAfterHeader: true, - commitChangelog: false, + commitChangelog: true, changelogToInject: ".tmp/n8nchangelog.txt", }, }, From 465fcbc7c67e5ac52612e02c8d21a65395732881 Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 3 Nov 2022 13:24:49 +0100 Subject: [PATCH 018/299] change changelog headers to MD format --- readme.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/readme.txt b/readme.txt index 81c4c1c5e..596a3a758 100644 --- a/readme.txt +++ b/readme.txt @@ -75,15 +75,15 @@ If Duplicate Post is still in English, or if there are some untranslated strings Release Date: June 28th, 2022 -Enhancements: +#### Enhancements * Improves the impact of the plugin on the performance of the site by avoiding useless calls on the `gettext` filter. -Bugfixes: +#### Bugfixes * Fixes a bug where a section in the Classic Editor's submitbox would be displayed with incorrect margins. -Other: +#### Other * Sets the WordPress tested up to version to 6.0. @@ -91,17 +91,17 @@ Other: Release Date: January 25th, 2022 -Enhancements: +#### Enhancements * Converts the upgrade notice into a welcome notice for first-time users. -Bugfixes: +#### Bugfixes * Fixes a bug where HTML tags in a Custom HTML block would be removed when republishing a scheduled Rewrite & Republish copy. * Fixes a bug where the button style would be broken in the Classic Editor. * Fixes a bug where a fatal error would be triggered in the Widgets page in combination with some themes or plugins. -Other: +#### Other * Sets the WordPress tested up to version to 5.9. From 7b1546386c07ea5a2d3f2e908875e540987cedd2 Mon Sep 17 00:00:00 2001 From: noud-github Date: Fri, 4 Nov 2022 10:29:48 +0100 Subject: [PATCH 019/299] change config to addapt to new changlog format --- config/grunt/task-config/update-changelog-to-latest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index 48f609aba..cc188f4f8 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -14,8 +14,8 @@ module.exports = { releaseInChangelog: /[#] \d+\.\d+(\.\d+)?\n\n/g, matchChangelogHeader: /[=]= Changelog ==\n\n/ig, newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease Date: " + "DATESTRING" + "\n", - matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\w\+?:\\n|= \\d+[\.\\d]+ =|= Earlier versions =))", - matchCorrectLines: "## " + "VERSIONNUMBER" + "(.|\\n)*?(?=(= \\d+[\.\\d]+ =|= Earlier versions =))", + matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\n#### \\w\+?\\n|= \\d+[\.\\d]+ =|= Earlier versions =))", + matchCorrectLines: "## " + "VERSIONNUMBER" + "(.|\\n)*?(?=(\\n## \\d+[\.\\d]+|= Earlier versions =))", matchCleanedChangelog: "## " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", replaceCleanedChangelog: "= Earlier versions =", pluginSlug: "duplicate-post", From b9d33e3f89babae68cf275293bf7b6b1314797e0 Mon Sep 17 00:00:00 2001 From: noud-github Date: Fri, 4 Nov 2022 11:05:09 +0100 Subject: [PATCH 020/299] change Date to date --- config/grunt/task-config/update-changelog-to-latest.js | 2 +- readme.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index cc188f4f8..0056aedcb 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -13,7 +13,7 @@ module.exports = { readmeFile: "./readme.txt", releaseInChangelog: /[#] \d+\.\d+(\.\d+)?\n\n/g, matchChangelogHeader: /[=]= Changelog ==\n\n/ig, - newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease Date: " + "DATESTRING" + "\n", + newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease date: " + "DATESTRING" + "\n", matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\n#### \\w\+?\\n|= \\d+[\.\\d]+ =|= Earlier versions =))", matchCorrectLines: "## " + "VERSIONNUMBER" + "(.|\\n)*?(?=(\\n## \\d+[\.\\d]+|= Earlier versions =))", matchCleanedChangelog: "## " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", diff --git a/readme.txt b/readme.txt index 596a3a758..92c47cdb5 100644 --- a/readme.txt +++ b/readme.txt @@ -73,7 +73,7 @@ If Duplicate Post is still in English, or if there are some untranslated strings ## 4.5 -Release Date: June 28th, 2022 +Release date: June 28th, 2022 #### Enhancements @@ -89,7 +89,7 @@ Release Date: June 28th, 2022 ## 4.4 -Release Date: January 25th, 2022 +Release date: January 25th, 2022 #### Enhancements From 8bc324bdb2ef10854c538927d9ce2af5d6cf1577 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 16 Oct 2022 00:57:52 +0200 Subject: [PATCH 021/299] GH Actions: fix use of deprecated `set-output` GitHub has deprecated the use of `set-output` (and `set-state`) in favour of new environment files. This commit updates workflows to use the new methodology. Refs: * https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files --- .github/workflows/deploy.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c19943fec..34eda3911 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -141,7 +141,7 @@ jobs: SHA: ${{ github.sha }} run: | shortsha=$(echo "$SHA" | cut -b 1-6) - echo "::set-output name=SHORTSHA::$shortsha" + echo "SHORTSHA=$shortsha" >> $GITHUB_OUTPUT - name: "Set variables: target branch, commit title" id: set_vars @@ -149,14 +149,14 @@ jobs: REF_NAME: ${{ github.ref_name }} run: | if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref_type }}" == 'branch' && "$REF_NAME" != "${{ env.DIST_DEFAULT_BRANCH }}" ]]; then - echo "::set-output name=BRANCH::$REF_NAME" - echo "::set-output name=TITLE::Syncing branch $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" + echo "BRANCH=$REF_NAME" >> $GITHUB_OUTPUT + echo "TITLE=Syncing branch $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> $GITHUB_OUTPUT elif [[ "${{ github.event_name }}" == 'workflow_dispatch' && "$REF_NAME" != "${{ env.DIST_DEFAULT_BRANCH }}" ]]; then - echo "::set-output name=BRANCH::$REF_NAME" - echo "::set-output name=TITLE::Manual deploy for $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" + echo "BRANCH=$REF_NAME" >> $GITHUB_OUTPUT + echo "TITLE=Manual deploy for $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> $GITHUB_OUTPUT else # = Pushed tag. - echo "::set-output name=BRANCH::${{ env.DIST_DEFAULT_BRANCH }}" - echo "::set-output name=TITLE::Release $REF_NAME" + echo "BRANCH=${{ env.DIST_DEFAULT_BRANCH }}" >> $GITHUB_OUTPUT + echo "TITLE=Release $REF_NAME" >> $GITHUB_OUTPUT fi - name: Checkout Yoast Dist repo From 3e858c7d3f5de31f82d7a3de7f3975ef31173542 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 23 Oct 2022 12:23:36 +0200 Subject: [PATCH 022/299] GH Actions: harden the workflow against PHPCS ruleset errors If there is a ruleset error, the `cs2pr` action doesn't receive an `xml` report and exits with a `0` error code, even though the PHPCS run failed (though not on CS errors, but on a ruleset error). This changes the GH Actions workflow to allow for that situation and still fail the build in that case. --- .github/workflows/cs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index fb87305c7..63c6a3457 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -45,8 +45,9 @@ jobs: # The results of the CS check will be shown inline in the PR via the CS2PR tool. # @link https://github.com/staabm/annotate-pull-request-from-checkstyle/ - name: Check PHP code style - continue-on-error: true + id: phpcs run: composer check-cs -- --report-full --report-checkstyle=./phpcs-report.xml - name: Show PHPCS results in PR + if: ${{ always() && steps.phpcs.outcome == 'failure' }} run: cs2pr ./phpcs-report.xml From 1fcb880bb7392814f35896a47ded3be0cd5d5d57 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 5 Nov 2022 19:06:27 +0100 Subject: [PATCH 023/299] GH Actions: bust the cache semi-regularly Caches used in GH Actions do not get updated, they can only be replaced by a different cache with a different cache key. Now the predefined Composer install action this repo is using already creates a pretty comprehensive cache key: > `ramsey/composer-install` will auto-generate a cache key which is composed of the following elements: > * The OS image name, like `ubuntu-latest`. > * The exact PHP version, like `8.1.11`. > * The options passed via `composer-options`. > * The dependency version setting as per `dependency-versions`. > * The working directory as per `working-directory`. > * A hash of the `composer.json` and/or `composer.lock` files. This means that aside from other factors, the cache will always be busted when changes are made to the (committed) `composer.json` or the `composer.lock` file (if the latter exists in the repo). For packages running on recent versions of PHP, it also means that the cache will automatically be busted once a month when a new PHP version comes out. ### The problem For runs on older PHP versions which don't receive updates anymore, the cache will not be busted via new PHP version releases, so effectively, the cache will only be busted when a change is made to the `composer.json`/`composer.lock` file - which may not happen that frequently on low-traffic repos. But... packages _in use_ on those older PHP versions - especially dependencies of declared dependencies - may still release new versions and those new versions will not exist in the cache and will need to be downloaded each time the action is run and over time the cache gets less and less relevant as more and more packages will need to be downloaded for each run. ### The solution To combat this issue, a new `custom-cache-suffix` option has been added to the Composer install action in version 2.2.0. This new option allows for providing some extra information to add to the cache key, which allows for busting the cache based on your own additional criteria. This commit implements the use of this `custom-cache-suffix` option for all relevant workflows in this repo. Refs: * https://github.com/ramsey/composer-install/#custom-cache-suffix * https://github.com/ramsey/composer-install/releases/tag/2.2.0 --- .github/workflows/cs.yml | 3 +++ .github/workflows/deploy.yml | 3 +++ .github/workflows/lint.yml | 3 +++ .github/workflows/test.yml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 63c6a3457..d3c1e53c8 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -40,6 +40,9 @@ jobs: # @link https://github.com/marketplace/actions/install-composer-dependencies - name: Install Composer dependencies uses: ramsey/composer-install@v2 + with: + # Bust the cache at least once a month - output format: YYYY-MM-DD. + custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") # Check the codestyle of the files. # The results of the CS check will be shown inline in the PR via the CS2PR tool. diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 34eda3911..cf6a28d3c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -88,6 +88,9 @@ jobs: # @link https://github.com/marketplace/actions/install-composer-dependencies - name: Install Composer dependencies uses: ramsey/composer-install@v2 + with: + # Bust the cache at least once a month - output format: YYYY-MM-DD. + custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") - name: Yarn install run: yarn install diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6ae316100..2653dcc20 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -50,6 +50,9 @@ jobs: # @link https://github.com/marketplace/actions/install-composer-dependencies - name: Install Composer dependencies uses: ramsey/composer-install@v2 + with: + # Bust the cache at least once a month - output format: YYYY-MM-DD. + custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") - name: Lint against parse errors run: composer lint -- --checkstyle | cs2pr diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f90be8d13..0f596b856 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,6 +44,9 @@ jobs: # @link https://github.com/marketplace/actions/install-composer-dependencies - name: Install Composer dependencies uses: ramsey/composer-install@v2 + with: + # Bust the cache at least once a month - output format: YYYY-MM-DD. + custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") - name: Run unit tests run: composer test From 50e32deb60a262b6b9ba259e04a25ba9cb564f75 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 5 Nov 2022 19:06:58 +0100 Subject: [PATCH 024/299] GH Actions: don't allow linting issues on PHP 8.2 --- .github/workflows/lint.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2653dcc20..09de3ef8f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -31,9 +31,6 @@ jobs: name: "Lint: PHP ${{ matrix.php_version }}" - # Allow builds to fail on as-of-yet unreleased PHP versions. - continue-on-error: ${{ matrix.php_version == '8.2' }} - steps: - name: Checkout code uses: actions/checkout@v3 From f71e0e957cabed372758c8b84a84ad518bcac757 Mon Sep 17 00:00:00 2001 From: noud-github Date: Mon, 7 Nov 2022 09:31:03 +0100 Subject: [PATCH 025/299] change minor change --- config/grunt/task-config/update-changelog-to-latest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index 0056aedcb..218cf00e2 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -14,7 +14,7 @@ module.exports = { releaseInChangelog: /[#] \d+\.\d+(\.\d+)?\n\n/g, matchChangelogHeader: /[=]= Changelog ==\n\n/ig, newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease date: " + "DATESTRING" + "\n", - matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\n#### \\w\+?\\n|= \\d+[\.\\d]+ =|= Earlier versions =))", + matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\n#### \\w\+?\\n|## \\d+[\.\\d]+|= Earlier versions =))", matchCorrectLines: "## " + "VERSIONNUMBER" + "(.|\\n)*?(?=(\\n## \\d+[\.\\d]+|= Earlier versions =))", matchCleanedChangelog: "## " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", replaceCleanedChangelog: "= Earlier versions =", From 5abf216739d4ebf7c231a99aadf9a1ebb579b12e Mon Sep 17 00:00:00 2001 From: manuelaugustin Date: Thu, 10 Nov 2022 15:45:07 +0100 Subject: [PATCH 026/299] Add WBSO section to PR template --- .github/PULL_REQUEST_TEMPLATE.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8771cc54a..bf54c1c5c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -80,4 +80,9 @@ This PR affects the following parts of the plugin, which may require extra testi * [ ] I have tested this code to the best of my abilities * [ ] I have added unittests to verify the code works as intended +## WBSO + +* [ ] No WBSO project is applicable for this PR. +* [ ] This PR falls under a WBSO project. I have attached the `innovation` label and noted the work hours. + Fixes # From 1e72172907d6ef9a687932ec4de07e6e25f3601b Mon Sep 17 00:00:00 2001 From: manuelaugustin Date: Thu, 10 Nov 2022 19:03:28 +0100 Subject: [PATCH 027/299] Adapt wording --- .github/PULL_REQUEST_TEMPLATE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index bf54c1c5c..d39949fa4 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -80,9 +80,9 @@ This PR affects the following parts of the plugin, which may require extra testi * [ ] I have tested this code to the best of my abilities * [ ] I have added unittests to verify the code works as intended -## WBSO +## Innovation -* [ ] No WBSO project is applicable for this PR. -* [ ] This PR falls under a WBSO project. I have attached the `innovation` label and noted the work hours. +* [ ] No innovation project is applicable for this PR. +* [ ] This PR falls under an innovation project. I have attached the `innovation` label and noted the work hours. Fixes # From 9ebbf6cb78d3a76d3f9419fa794197aba44cee74 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Nov 2022 02:21:08 +0000 Subject: [PATCH 028/299] Bump loader-utils from 1.4.0 to 1.4.2 Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2. - [Release notes](https://github.com/webpack/loader-utils/releases) - [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md) - [Commits](https://github.com/webpack/loader-utils/compare/v1.4.0...v1.4.2) --- updated-dependencies: - dependency-name: loader-utils dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index a42d06050..569521317 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6311,9 +6311,9 @@ loader-runner@^2.4.0: integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== loader-utils@^1.0.2, loader-utils@^1.2.3: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613" - integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA== + version "1.4.2" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3" + integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg== dependencies: big.js "^5.2.2" emojis-list "^3.0.0" @@ -6614,11 +6614,16 @@ minimalistic-crypto-utils@^1.0.1: dependencies: brace-expansion "^1.1.7" -minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: +minimist@^1.1.3, minimist@^1.2.3, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +minimist@^1.2.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" + integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== + mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" From c6df159b71f5f5d83443b1c9595f6401a1e68b4f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 17 Nov 2022 01:44:27 +0100 Subject: [PATCH 029/299] Composer: update test utilities Refs: * https://github.com/Yoast/PHPUnit-Polyfills/releases/tag/1.0.4 * https://github.com/Yoast/wp-test-utils/releases/tag/1.1.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cb43f5004..01316e707 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "yoast/yoastcs": "^2.2.1", - "yoast/wp-test-utils": "^1.0.0", + "yoast/wp-test-utils": "^1.1.0", "roave/security-advisories": "dev-master" }, "autoload": { From c9e85ff2b6ebabca8a7dc428e4ae4cab414c7ae9 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 17 Nov 2022 15:34:50 +0100 Subject: [PATCH 030/299] Composer: update test utilities Refs: * https://github.com/Yoast/wp-test-utils/releases/tag/1.1.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 01316e707..73253743a 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "yoast/yoastcs": "^2.2.1", - "yoast/wp-test-utils": "^1.1.0", + "yoast/wp-test-utils": "^1.1.1", "roave/security-advisories": "dev-master" }, "autoload": { From 09efa1f647b1f7c8b75c5c92e0859d1bf0fca6eb Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 6 Nov 2022 00:55:37 +0100 Subject: [PATCH 031/299] Tests: use import `use` statements for all referenced WP native classes --- tests/admin/options-form-generator-test.php | 14 ++++++++------ tests/testcase.php | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/admin/options-form-generator-test.php b/tests/admin/options-form-generator-test.php index a8de39c72..297e64660 100644 --- a/tests/admin/options-form-generator-test.php +++ b/tests/admin/options-form-generator-test.php @@ -5,6 +5,8 @@ use Brain\Monkey; use Mockery; use stdClass; +use WP_Post_Type; +use WP_Taxonomy; use Yoast\WP\Duplicate_Post\Admin\Options_Form_Generator; use Yoast\WP\Duplicate_Post\Admin\Options_Inputs; use Yoast\WP\Duplicate_Post\Tests\TestCase; @@ -48,13 +50,13 @@ protected function set_up() { 'edit_posts' => 'edit_posts', ]; - $post_type1 = Mockery::mock( 'WP_Post_Type' ); + $post_type1 = Mockery::mock( WP_Post_Type::class ); $post_type1->name = 'Books'; $post_type1->show_ui = true; $post_type1->labels = $labels; $post_type1->cap = (object) $caps; - $post_type2 = Mockery::mock( 'WP_Post_Type' ); + $post_type2 = Mockery::mock( WP_Post_Type::class ); $post_type2->name = 'Movies'; $post_type2->show_ui = true; $post_type2->labels = $labels; @@ -304,22 +306,22 @@ public function test_generate_taxonomy_exclusion_list() { $labels4 = new stdClass(); $labels4->name = 'Bar'; - $taxonomy1 = Mockery::mock( 'WP_Taxonomy' ); + $taxonomy1 = Mockery::mock( WP_Taxonomy::class ); $taxonomy1->name = 'custom_taxonomy_public_1'; $taxonomy1->public = true; $taxonomy1->labels = $labels1; - $taxonomy2 = Mockery::mock( 'WP_Taxonomy' ); + $taxonomy2 = Mockery::mock( WP_Taxonomy::class ); $taxonomy2->name = 'custom_taxonomy_private_2'; $taxonomy2->public = false; $taxonomy2->labels = $labels2; - $taxonomy3 = Mockery::mock( 'WP_Taxonomy' ); + $taxonomy3 = Mockery::mock( WP_Taxonomy::class ); $taxonomy3->name = 'custom_taxonomy_public_2'; $taxonomy3->public = true; $taxonomy3->labels = $labels3; - $taxonomy4 = Mockery::mock( 'WP_Taxonomy' ); + $taxonomy4 = Mockery::mock( WP_Taxonomy::class ); $taxonomy4->name = 'custom_taxonomy_private_1'; $taxonomy4->public = false; $taxonomy4->labels = $labels4; diff --git a/tests/testcase.php b/tests/testcase.php index 96eedfc79..a0e370868 100644 --- a/tests/testcase.php +++ b/tests/testcase.php @@ -4,6 +4,7 @@ use Brain\Monkey\Functions; use Mockery; +use WP_Role; use Yoast\WPTestUtils\BrainMonkey\YoastTestCase; /** @@ -19,7 +20,7 @@ abstract class TestCase extends YoastTestCase { protected function stub_wp_roles() { // Mock roles to use across several tests. - $role1 = Mockery::mock( 'WP_Role' ); + $role1 = Mockery::mock( WP_Role::class ); $role1->name = 'Editor'; $role1->capabilities = [ 'read' => 'read', @@ -34,7 +35,7 @@ protected function stub_wp_roles() { ] ); - $role2 = Mockery::mock( 'WP_Role' ); + $role2 = Mockery::mock( WP_Role::class ); $role2->name = 'Administrator'; $role2->capabilities = [ 'read' => 'read', @@ -49,7 +50,7 @@ protected function stub_wp_roles() { ] ); - $role3 = Mockery::mock( 'WP_Role' ); + $role3 = Mockery::mock( WP_Role::class ); $role3->name = 'Subscriber'; $role3->capabilities = []; $role3->allows( From 3e668888b925bceb7220b280966f881cad245a08 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 17 Nov 2022 02:52:13 +0100 Subject: [PATCH 032/299] Tests: on the fly create test doubles of unavailable WP classes --- tests/bootstrap.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3efcab2ea..11f772cfe 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -19,3 +19,16 @@ require_once __DIR__ . '/../vendor/yoast/wp-test-utils/src/BrainMonkey/bootstrap.php'; require_once __DIR__ . '/../vendor/autoload.php'; + +// Create the necessary test doubles for WP native classes on which properties are being set. +Yoast\WPTestUtils\BrainMonkey\makeDoublesForUnavailableClasses( + [ + 'WP_Post', + 'WP_Post_Type', + 'WP_Role', + 'WP_Screen', + 'WP_Taxonomy', + 'WP_Term', + 'WP_User', + ] +); From d23938ee43b4f9496e0420211d530b3abd7f0da4 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 17 Nov 2022 03:24:55 +0100 Subject: [PATCH 033/299] Admin_Bar_Test: minor test tweaks Document why a non-existent property is being set on `WP_Term` and that this is intentional. Includes adding a missing negative function call expectation. --- tests/ui/admin-bar-test.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/ui/admin-bar-test.php b/tests/ui/admin-bar-test.php index a1245b619..5c3eed1cf 100644 --- a/tests/ui/admin-bar-test.php +++ b/tests/ui/admin-bar-test.php @@ -490,8 +490,13 @@ public function test_get_current_post_unsuccessful_backend() { */ public function test_get_current_post_unsuccessful_frontend() { global $wp_the_query; - $wp_the_query = Mockery::mock( WP_Query::class ); - $post = Mockery::mock( WP_Term::class ); + $wp_the_query = Mockery::mock( WP_Query::class ); + $post = Mockery::mock( WP_Term::class ); + + /* + * Take note that the property being set is not a property declared on WP_Term, + * it just needs to be set to test a specific edge-case. + */ $post->post_type = 'post'; Monkey\Functions\expect( '\is_admin' ) @@ -513,6 +518,9 @@ public function test_get_current_post_unsuccessful_frontend() { ->expects( 'is_edit_post_screen' ) ->never(); + Monkey\Functions\expect( '\is_singular' ) + ->never(); + $this->permissions_helper ->expects( 'post_type_has_admin_bar' ) ->with( $post->post_type ) From 4935f0af2576fed0709862ed46ff3325065a2b0a Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 24 Feb 2022 00:18:49 +0100 Subject: [PATCH 034/299] GH Actions: run the tests against PHP 8.2 ... and as the tests currently pass without issue, don't allow the build to fail. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f596b856..b5df26c6b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: - php_version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + php_version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] name: "Unit Test: PHP ${{ matrix.php_version }}" From bc7e8f6d8c351d3a5df8a1df8a0acc171df7ebc7 Mon Sep 17 00:00:00 2001 From: Daria Date: Mon, 21 Nov 2022 13:46:51 +0100 Subject: [PATCH 035/299] Create Bug_report.md Created Bug report template. --- .github/ISSUE_TEMPLATE/Bug_report.md | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/Bug_report.md diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 000000000..860afe31d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,57 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + + + +* [ ] I've searched for any related issues and avoided creating a duplicate issue. + +### Please give us a description of what happened + +### To Reproduce +#### Step-by-step reproduction instructions +1. +2. +3. + +#### Expected results +1. + +#### Actual results +1. + + +### Screenshots, screen recording, code snippet +If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug. + +### Technical info + +* If relevant, which editor is affected (or editors): +- [ ] Block Editor +- [ ] Gutenberg Edior +- [ ] Classic Editor +- [ ] Other: + + +* Which browser is affected (or browsers): +- [ ] Chrome +- [ ] Firefox +- [ ] Safari +- [ ] Other: + +#### Used versions +* Device you are using: +* Operating system: +* WordPress version: +* WordPress Theme: +* Yoast Duplicate Post version: +* Gutenberg plugin version: +* Classic Editor plugin version: +* Relevant plugins in case of a bug: + From 3b2ffe4d90464af401fc7c864f7cb9ab5a179a22 Mon Sep 17 00:00:00 2001 From: Daria Date: Mon, 21 Nov 2022 13:49:03 +0100 Subject: [PATCH 036/299] Update Bug_report.md small update --- .github/ISSUE_TEMPLATE/Bug_report.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 860afe31d..408216819 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -54,4 +54,3 @@ If possible, please provide a screenshot, a screen recording or a code snippet w * Gutenberg plugin version: * Classic Editor plugin version: * Relevant plugins in case of a bug: - From 94fd4ebbae7e16c81fa4833d950a77ae7e1f1a15 Mon Sep 17 00:00:00 2001 From: Daria Date: Mon, 21 Nov 2022 17:26:39 +0100 Subject: [PATCH 037/299] Update Bug_report.md added PHP version --- .github/ISSUE_TEMPLATE/Bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 408216819..ef999db6c 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -48,6 +48,7 @@ If possible, please provide a screenshot, a screen recording or a code snippet w #### Used versions * Device you are using: * Operating system: +* PHP version: * WordPress version: * WordPress Theme: * Yoast Duplicate Post version: From cbe733b01de07d27d5fbfc31641e4f9a4aef58ae Mon Sep 17 00:00:00 2001 From: noud-github Date: Tue, 29 Nov 2022 14:59:53 +0100 Subject: [PATCH 038/299] update changelog format --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 92c47cdb5..43b99b4e0 100644 --- a/readme.txt +++ b/readme.txt @@ -71,7 +71,7 @@ If Duplicate Post is still in English, or if there are some untranslated strings == Changelog == -## 4.5 += 4.5 = Release date: June 28th, 2022 @@ -87,7 +87,7 @@ Release date: June 28th, 2022 * Sets the WordPress tested up to version to 6.0. -## 4.4 += 4.4 = Release date: January 25th, 2022 From 24580d42f54fb08900e63cc3016266bd58aeee56 Mon Sep 17 00:00:00 2001 From: noud-github Date: Tue, 29 Nov 2022 15:04:20 +0100 Subject: [PATCH 039/299] update format in grunt task --- config/grunt/task-config/update-changelog-to-latest.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/grunt/task-config/update-changelog-to-latest.js b/config/grunt/task-config/update-changelog-to-latest.js index 218cf00e2..91178bf64 100644 --- a/config/grunt/task-config/update-changelog-to-latest.js +++ b/config/grunt/task-config/update-changelog-to-latest.js @@ -11,12 +11,12 @@ module.exports = { // // Enhancements: readmeFile: "./readme.txt", - releaseInChangelog: /[#] \d+\.\d+(\.\d+)?\n\n/g, + releaseInChangelog: /[=] \d+\.\d+(\.\d+)? =/g, matchChangelogHeader: /[=]= Changelog ==\n\n/ig, - newHeadertemplate: "== Changelog ==\n\n" + "## " + "VERSIONNUMBER" + "\n\nRelease date: " + "DATESTRING" + "\n", - matchCorrectHeader: "## " + "VERSIONNUMBER" + "(.|\\n)*?\\n(?=(\\n#### \\w\+?\\n|## \\d+[\.\\d]+|= Earlier versions =))", - matchCorrectLines: "## " + "VERSIONNUMBER" + "(.|\\n)*?(?=(\\n## \\d+[\.\\d]+|= Earlier versions =))", - matchCleanedChangelog: "## " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", + newHeadertemplate: "== Changelog ==\n\n" + "= " + "VERSIONNUMBER" + " =\n\nRelease date: " + "DATESTRING" + "\n", + matchCorrectHeader: "= " + "VERSIONNUMBER" + " =(.|\\n)*?\\n(?=(\\n#### \\w\+?\\n|= \\d+[\.\\d]+|= Earlier versions =))", + matchCorrectLines: "= " + "VERSIONNUMBER" + " =(.|\\n)*?(?=(= \\d+[\.\\d]+ =|= Earlier versions =))", + matchCleanedChangelog: "= " + "VERSIONNUMBER" + "(.|\\n)*= Earlier versions =", replaceCleanedChangelog: "= Earlier versions =", pluginSlug: "duplicate-post", defaultChangelogEntries: "", From 83a8806cd7fe76d863d2282baa9207d6d267b941 Mon Sep 17 00:00:00 2001 From: Thijs van der Heijden Date: Mon, 5 Dec 2022 11:22:18 +0100 Subject: [PATCH 040/299] Set minimum WP version to 6.0 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 43b99b4e0..00758a916 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: yoast, lopo Donate link: https://yoast.com/wordpress/plugins/duplicate-post/ Tags: duplicate post, copy, clone -Requires at least: 5.9 +Requires at least: 6.0 Tested up to: 6.1 Stable tag: 4.5 Requires PHP: 5.6.20 From 2e42b6c81367caae85b47ef47f1b5f5b7b7c6827 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Dec 2022 00:49:00 +0000 Subject: [PATCH 041/299] Bump qs from 6.5.2 to 6.5.3 Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3. - [Release notes](https://github.com/ljharb/qs/releases) - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.5.3) --- updated-dependencies: - dependency-name: qs dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a42d06050..0fb385c73 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7992,9 +7992,9 @@ qs@^6.4.0, qs@^6.5.2: integrity sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ== qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + version "6.5.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" + integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== query-string@^5.0.1: version "5.1.1" From 115b09162e1e281177490f0d2f90030e921a5be0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Dec 2022 03:25:09 +0000 Subject: [PATCH 042/299] Bump decode-uri-component from 0.2.0 to 0.2.2 Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2. - [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases) - [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2) --- updated-dependencies: - dependency-name: decode-uri-component dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a42d06050..f4036d0dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3480,9 +3480,9 @@ decamelize@^1.1.2, decamelize@^1.2.0: integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== decompress-response@^3.2.0, decompress-response@^3.3.0: version "3.3.0" From a8467e3d943e98a865253baeb155c99e7701efed Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Mon, 12 Dec 2022 16:39:52 +0100 Subject: [PATCH 043/299] Update .github/ISSUE_TEMPLATE/Bug_report.md --- .github/ISSUE_TEMPLATE/Bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index ef999db6c..99d872cdd 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -34,7 +34,7 @@ If possible, please provide a screenshot, a screen recording or a code snippet w --> * If relevant, which editor is affected (or editors): - [ ] Block Editor -- [ ] Gutenberg Edior +- [ ] Gutenberg Editor - [ ] Classic Editor - [ ] Other: From bb999738862a7167c9ed0bb4c3ec6dccaa3a1136 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 19 Dec 2022 13:03:15 +0100 Subject: [PATCH 044/299] GH Actions: minor simplification ... of the bash `date` command in the earlier pulled cache busting. --- .github/workflows/cs.yml | 4 ++-- .github/workflows/deploy.yml | 4 ++-- .github/workflows/lint.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index d3c1e53c8..322e45d87 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -41,8 +41,8 @@ jobs: - name: Install Composer dependencies uses: ramsey/composer-install@v2 with: - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") # Check the codestyle of the files. # The results of the CS check will be shown inline in the PR via the CS2PR tool. diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cf6a28d3c..0ffe5a1e7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -89,8 +89,8 @@ jobs: - name: Install Composer dependencies uses: ramsey/composer-install@v2 with: - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") - name: Yarn install run: yarn install diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 09de3ef8f..870c3886d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -48,8 +48,8 @@ jobs: - name: Install Composer dependencies uses: ramsey/composer-install@v2 with: - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") - name: Lint against parse errors run: composer lint -- --checkstyle | cs2pr diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5df26c6b..f17cde555 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,8 @@ jobs: - name: Install Composer dependencies uses: ramsey/composer-install@v2 with: - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") - name: Run unit tests run: composer test From 1e01abe20f63236f0bae3c73da27d474f9023e42 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 19 Dec 2022 13:14:53 +0100 Subject: [PATCH 045/299] GH Actions: improve performance of the CS step All the repos in the Yoast organisation contain a `` directive in the PHPCS ruleset. This directive makes running PHPCS faster by caching the run results in a file and only scanning changed files when running PHPCS again. However, when there is no cache available, running with the `cache` option enabled will make PHPCS _slower_ as the cache needs to be created and the file read/write actions slow PHPCS down. In GH Actions, we are not caching the PHPCS `cache` file, which means that there is cache file available and running with `cache` will be slower. By adding the `--no-cache` option, the `cache` directive in the ruleset is ignored, which should result in a slightly faster runtime for the CS workflow. Note: the alternative would be to _cache_ the cache file in GH Actions, but aside from the two very frequently changing repos, there's not much point doing that. --- .github/workflows/cs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 322e45d87..bdf317226 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -49,7 +49,7 @@ jobs: # @link https://github.com/staabm/annotate-pull-request-from-checkstyle/ - name: Check PHP code style id: phpcs - run: composer check-cs -- --report-full --report-checkstyle=./phpcs-report.xml + run: composer check-cs -- --no-cache --report-full --report-checkstyle=./phpcs-report.xml - name: Show PHPCS results in PR if: ${{ always() && steps.phpcs.outcome == 'failure' }} From 1aae6b27d2a1d490d9dd67648303b105d099ec59 Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 5 Jan 2023 15:19:58 +0100 Subject: [PATCH 046/299] update plugin-grunt-tasks to 2.4 --- package.json | 4 ++-- yarn.lock | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 769b43329..ea516f306 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "devDependencies": { "@wordpress/data": "^4.25.0", "@wordpress/dependency-extraction-webpack-plugin": "^2.8.0", - "@yoast/grunt-plugin-tasks": "^2.3", + "@yoast/grunt-plugin-tasks": "^2.4", "babel-core": "^6.26.3", "babel-eslint": "^10.1.0", "babel-loader": "7", @@ -42,8 +42,8 @@ "babelify": "^10.0.0", "case-sensitive-paths-webpack-plugin": "^2.3.0", "grunt": "^1.3.0", - "grunt-git": "^1.0.14", "grunt-contrib-clean": "^2.0.0", + "grunt-git": "^1.0.14", "grunt-shell": "^3.0.1", "grunt-webpack": "^4.0.2", "load-grunt-config": "^3.0.1", diff --git a/yarn.lock b/yarn.lock index a42d06050..5fc23fb0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1122,10 +1122,10 @@ resolved "https://registry.yarnpkg.com/@yoast/browserslist-config/-/browserslist-config-1.2.2.tgz#ebe69768f5b352b5814111cb010867a024667d69" integrity sha512-ri5c2daBpAiKhN5pgcylw8rYWu1MGK+Uz6h/DtqqZEjE6rEjHxdPGv+0hL88is1HEdubyhZTcK9Y5gzcnY6f8A== -"@yoast/grunt-plugin-tasks@^2.3": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@yoast/grunt-plugin-tasks/-/grunt-plugin-tasks-2.3.0.tgz#9dcefbd64fd3a301fbb9ab55307e1b48f232bbd9" - integrity sha512-1NudJYAKOaGKveLYv3axZ+ecCrL1gSikkZZynev7m//dCEt+WhuX0wzimGBGiwrHtkbMGPKBFjBS+CFhPM3jIA== +"@yoast/grunt-plugin-tasks@^2.4": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@yoast/grunt-plugin-tasks/-/grunt-plugin-tasks-2.4.0.tgz#3aa8984bc11bc44d1e62119dd7c16888f25cccd2" + integrity sha512-CcCwpyWqMxNkDAPeSrNbYW/JjrOGFg1AzG7NEAwkQY3BD6RDqh93z7ALKhQyeLPhL3KjQGkZOCYboSqY1jgwvw== dependencies: "@yoast/browserslist-config" "^1.0.0" autoprefixer "^9.7.2" @@ -1145,7 +1145,7 @@ grunt-contrib-uglify "^4.0.1" grunt-contrib-watch "^1.0.0" grunt-eslint "^21.0.0" - grunt-glotpress "https://github.com/Yoast/grunt-glotpress.git#master" + grunt-glotpress "https://github.com/Yoast/grunt-glotpress.git#main" grunt-postcss "^0.9.0" grunt-replace "^1.0.1" grunt-rtlcss "^2.0.2" @@ -5085,9 +5085,9 @@ grunt-git@^1.0.14: dependencies: flopmang "^1.0.0" -"grunt-glotpress@https://github.com/Yoast/grunt-glotpress.git#master": +"grunt-glotpress@git+https://github.com/Yoast/grunt-glotpress.git#main": version "0.3.0" - resolved "https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" + resolved "git+https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" dependencies: request "^2.88.0" request-promise-native "^1.0.7" From 89fc009bc5b9cabb092f97ea75dad817de84c086 Mon Sep 17 00:00:00 2001 From: noud-github Date: Thu, 5 Jan 2023 15:22:06 +0100 Subject: [PATCH 047/299] update changelog date format --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 00758a916..fe43cbce3 100644 --- a/readme.txt +++ b/readme.txt @@ -73,7 +73,7 @@ If Duplicate Post is still in English, or if there are some untranslated strings = 4.5 = -Release date: June 28th, 2022 +Release date: 2022-06-28 #### Enhancements @@ -89,7 +89,7 @@ Release date: June 28th, 2022 = 4.4 = -Release date: January 25th, 2022 +Release date: 2022-01-25 #### Enhancements From 2017980fc64504dcfea0ba36a024c4b5f009b0fc Mon Sep 17 00:00:00 2001 From: BobBreukhoven <51359933+BobBreukhoven@users.noreply.github.com> Date: Fri, 6 Jan 2023 10:11:00 +0100 Subject: [PATCH 048/299] Create Task_template.md --- .github/ISSUE_TEMPLATE/Task_template.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/Task_template.md diff --git a/.github/ISSUE_TEMPLATE/Task_template.md b/.github/ISSUE_TEMPLATE/Task_template.md new file mode 100644 index 000000000..9251f4725 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Task_template.md @@ -0,0 +1,21 @@ +--- +name: Task +about: A template for general issues + +--- +## What is the goal of this issue? + + +## What needs to be done to achieve the goal? + + +## Does the issue still need UX or research? + + +## If available: what are the tips for fixing the problem or possible solutions? + + +## What is the expected result/behavior? + + +## Should documentation be added or updated for this change? and if so, where? From 08331db450697a46f0b17cb0d76efff793780fc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:01:53 +0000 Subject: [PATCH 049/299] Bump grunt from 1.3.0 to 1.5.3 Bumps [grunt](https://github.com/gruntjs/grunt) from 1.3.0 to 1.5.3. - [Release notes](https://github.com/gruntjs/grunt/releases) - [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG) - [Commits](https://github.com/gruntjs/grunt/compare/v1.3.0...v1.5.3) --- updated-dependencies: - dependency-name: grunt dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 216 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 131 insertions(+), 87 deletions(-) diff --git a/package.json b/package.json index ea516f306..f70cd4caa 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "babel-preset-react": "^6.24.1", "babelify": "^10.0.0", "case-sensitive-paths-webpack-plugin": "^2.3.0", - "grunt": "^1.3.0", + "grunt": "^1.5.3", "grunt-contrib-clean": "^2.0.0", "grunt-git": "^1.0.14", "grunt-shell": "^3.0.1", diff --git a/yarn.lock b/yarn.lock index 5fc23fb0e..c1e6185b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1510,7 +1510,7 @@ async-each@^1.0.1: resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== -async@^1.5.2, async@~1.5.2: +async@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= @@ -1522,6 +1522,11 @@ async@^2.0.0, async@^2.6.0, async@^2.6.1: dependencies: lodash "^4.17.14" +async@~3.2.0: + version "3.2.4" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" + integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -2434,7 +2439,7 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" -braces@~3.0.2: +braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -4205,7 +4210,7 @@ executable@^4.1.0: dependencies: pify "^2.2.0" -exit@~0.1.1, exit@~0.1.2: +exit@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= @@ -4265,7 +4270,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@^3.0.0, extend@~3.0.2: +extend@^3.0.2, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== @@ -4526,14 +4531,14 @@ find-versions@^3.0.0: dependencies: semver-regex "^2.0.0" -findup-sync@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-2.0.0.tgz#9326b1488c22d1a6088650a86901b2d9a90a2cbc" - integrity sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw= +findup-sync@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-4.0.0.tgz#956c9cdde804052b881b428512905c4a5f2cdef0" + integrity sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ== dependencies: detect-file "^1.0.0" - is-glob "^3.1.0" - micromatch "^3.0.4" + is-glob "^4.0.0" + micromatch "^4.0.2" resolve-dir "^1.0.1" findup-sync@~0.3.0: @@ -4543,7 +4548,7 @@ findup-sync@~0.3.0: dependencies: glob "~5.0.0" -fined@^1.0.1: +fined@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/fined/-/fined-1.2.0.tgz#d00beccf1aa2b475d16d423b0238b713a2c4a37b" integrity sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng== @@ -4554,7 +4559,7 @@ fined@^1.0.1: object.pick "^1.2.0" parse-filepath "^1.0.1" -flagged-respawn@^1.0.0: +flagged-respawn@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41" integrity sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q== @@ -4759,10 +4764,10 @@ get-value@^2.0.3, get-value@^2.0.6: resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= -getobject@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/getobject/-/getobject-0.1.0.tgz#047a449789fa160d018f5486ed91320b6ec7885c" - integrity sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw= +getobject@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/getobject/-/getobject-1.0.2.tgz#25ec87a50370f6dcc3c6ba7ef43c4c16215c4c89" + integrity sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg== getpass@^0.1.1: version "0.1.7" @@ -4986,16 +4991,16 @@ grunt-checktextdomain@^1.0.1: chalk "~0.2.1" text-table "~0.2.0" -grunt-cli@~1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/grunt-cli/-/grunt-cli-1.3.2.tgz#60f12d12c1b5aae94ae3469c6b5fe24e960014e8" - integrity sha512-8OHDiZZkcptxVXtMfDxJvmN7MVJNE8L/yIcPb4HB7TlyFD1kDvjHrb62uhySsU14wJx9ORMnTuhRMQ40lH/orQ== +grunt-cli@~1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/grunt-cli/-/grunt-cli-1.4.3.tgz#22c9f1a3d2780bf9b0d206e832e40f8f499175ff" + integrity sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ== dependencies: - grunt-known-options "~1.1.0" + grunt-known-options "~2.0.0" interpret "~1.1.0" - liftoff "~2.5.0" + liftup "~3.0.1" nopt "~4.0.1" - v8flags "~3.1.1" + v8flags "~3.2.0" grunt-contrib-clean@^2.0.0: version "2.0.0" @@ -5085,17 +5090,18 @@ grunt-git@^1.0.14: dependencies: flopmang "^1.0.0" -"grunt-glotpress@git+https://github.com/Yoast/grunt-glotpress.git#main": +"grunt-glotpress@https://github.com/Yoast/grunt-glotpress.git#main": version "0.3.0" - resolved "git+https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" + uid e6ccc69c2532d126f5d8a30397ffd012e55b6eec + resolved "https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" dependencies: request "^2.88.0" request-promise-native "^1.0.7" -grunt-known-options@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/grunt-known-options/-/grunt-known-options-1.1.1.tgz#6cc088107bd0219dc5d3e57d91923f469059804d" - integrity sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ== +grunt-known-options@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/grunt-known-options/-/grunt-known-options-2.0.0.tgz#cac641e897f9a0a680b8c9839803d35f3325103c" + integrity sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA== grunt-legacy-log-utils@~2.1.0: version "2.1.0" @@ -5115,18 +5121,18 @@ grunt-legacy-log@~3.0.0: hooker "~0.2.3" lodash "~4.17.19" -grunt-legacy-util@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/grunt-legacy-util/-/grunt-legacy-util-2.0.0.tgz#34d20f2a26c6adebfe9a9bdc8823f7016b0369c3" - integrity sha512-ZEmYFB44bblwPE2oz3q3ygfF6hseQja9tx8I3UZIwbUik32FMWewA+d1qSFicMFB+8dNXDkh35HcDCWlpRsGlA== +grunt-legacy-util@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/grunt-legacy-util/-/grunt-legacy-util-2.0.1.tgz#0f929d13a2faf9988c9917c82bff609e2d9ba255" + integrity sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w== dependencies: - async "~1.5.2" - exit "~0.1.1" - getobject "~0.1.0" + async "~3.2.0" + exit "~0.1.2" + getobject "~1.0.0" hooker "~0.2.3" - lodash "~4.17.20" + lodash "~4.17.21" underscore.string "~3.3.5" - which "~1.3.0" + which "~2.0.2" grunt-postcss@^0.9.0: version "0.9.0" @@ -5196,20 +5202,20 @@ grunt-wp-i18n@^1.0.3: grunt "^1.0.3" node-wp-i18n "^1.2.2" -grunt@^1.0.3, grunt@^1.1, grunt@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/grunt/-/grunt-1.3.0.tgz#55db6ccd80c6fb53722e496f680620a2e681f809" - integrity sha512-6ILlMXv11/4cxuhSMfSU+SfvbxrPuqZrAtLN64+tZpQ3DAKfSQPQHRbTjSbdtxfyQhGZPtN0bDZJ/LdCM5WXXA== +grunt@^1.0.3, grunt@^1.1, grunt@^1.5.3: + version "1.5.3" + resolved "https://registry.yarnpkg.com/grunt/-/grunt-1.5.3.tgz#3214101d11257b7e83cf2b38ea173b824deab76a" + integrity sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ== dependencies: dateformat "~3.0.3" eventemitter2 "~0.4.13" exit "~0.1.2" findup-sync "~0.3.0" glob "~7.1.6" - grunt-cli "~1.3.2" - grunt-known-options "~1.1.0" + grunt-cli "~1.4.3" + grunt-known-options "~2.0.0" grunt-legacy-log "~3.0.0" - grunt-legacy-util "~2.0.0" + grunt-legacy-util "~2.0.1" iconv-lite "~0.4.13" js-yaml "~3.14.0" minimatch "~3.0.4" @@ -5729,6 +5735,13 @@ is-core-module@^2.1.0: dependencies: has "^1.0.3" +is-core-module@^2.9.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" + integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== + dependencies: + has "^1.0.3" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -6047,7 +6060,7 @@ js-yaml@3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.3.0, js-yaml@^3.6.0: +js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.3.0, js-yaml@^3.6.0, js-yaml@~3.14.0: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -6063,14 +6076,6 @@ js-yaml@~3.12.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@~3.14.0: - version "3.14.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" - integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -6219,19 +6224,19 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -liftoff@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/liftoff/-/liftoff-2.5.0.tgz#2009291bb31cea861bbf10a7c15a28caf75c31ec" - integrity sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew= +liftup@~3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/liftup/-/liftup-3.0.1.tgz#1cb81aff0f368464ed3a5f1a7286372d6b1a60ce" + integrity sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw== dependencies: - extend "^3.0.0" - findup-sync "^2.0.0" - fined "^1.0.1" - flagged-respawn "^1.0.0" + extend "^3.0.2" + findup-sync "^4.0.0" + fined "^1.2.0" + flagged-respawn "^1.0.1" is-plain-object "^2.0.4" - object.map "^1.0.0" - rechoir "^0.6.2" - resolve "^1.1.7" + object.map "^1.0.1" + rechoir "^0.7.0" + resolve "^1.19.0" line-height@^0.3.1: version "0.3.1" @@ -6360,11 +6365,16 @@ lodash@^3.10.0: resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" integrity sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y= -lodash@^4.1.1, lodash@^4.11.0, lodash@^4.14.2, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.4, lodash@^4.7.0, lodash@^4.8.0, lodash@~4.17.10, lodash@~4.17.11, lodash@~4.17.19, lodash@~4.17.20: +lodash@^4.1.1, lodash@^4.11.0, lodash@^4.14.2, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.4, lodash@^4.7.0, lodash@^4.8.0, lodash@~4.17.10, lodash@~4.17.11, lodash@~4.17.19: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash@~4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + logalot@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/logalot/-/logalot-2.1.0.tgz#5f8e8c90d304edf12530951a5554abb8c5e3f552" @@ -6538,7 +6548,7 @@ merge2@^1.2.3: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: +micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -6557,6 +6567,14 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@^4.0.2: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -7036,7 +7054,7 @@ object.getownpropertydescriptors@^2.1.0: define-properties "^1.1.3" es-abstract "^1.18.0-next.1" -object.map@^1.0.0: +object.map@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/object.map/-/object.map-1.0.1.tgz#cf83e59dc8fcc0ad5f4250e1f78b3b81bd801d37" integrity sha1-z4Plncj8wK1fQlDh94s7gb2AHTc= @@ -7367,7 +7385,7 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= -path-parse@^1.0.6: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -7431,6 +7449,11 @@ picomatch@^2.0.4, picomatch@^2.2.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + pify@^2.0.0, pify@^2.2.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -8339,12 +8362,12 @@ reakit@^1.1.0: reakit-utils "^0.14.4" reakit-warning "^0.5.5" -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= +rechoir@^0.7.0: + version "0.7.1" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.1.tgz#9478a96a1ca135b5e88fc027f03ee92d6c645686" + integrity sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg== dependencies: - resolve "^1.1.6" + resolve "^1.9.0" redent@^1.0.0: version "1.0.0" @@ -8591,7 +8614,15 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.1.6, resolve@^1.1.7, resolve@^1.12.0: +resolve@^1.10.0, resolve@^1.18.1: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + +resolve@^1.12.0: version "1.18.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.18.1.tgz#018fcb2c5b207d2a6424aee361c5a266da8f4130" integrity sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA== @@ -8599,13 +8630,14 @@ resolve@^1.1.6, resolve@^1.1.7, resolve@^1.12.0: is-core-module "^2.0.0" path-parse "^1.0.6" -resolve@^1.10.0, resolve@^1.18.1: - version "1.19.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" - integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== +resolve@^1.19.0, resolve@^1.9.0: + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.1.0" - path-parse "^1.0.6" + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" responselike@1.0.2: version "1.0.2" @@ -9303,6 +9335,11 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + svgo@^1.0.0, svgo@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.2.tgz#b6dc511c063346c9e415b81e43401145b96d4167" @@ -9824,10 +9861,10 @@ uuid@^7.0.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== -v8flags@~3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.3.tgz#fc9dc23521ca20c5433f81cc4eb9b3033bb105d8" - integrity sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w== +v8flags@~3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.2.0.tgz#b243e3b4dfd731fa774e7492128109a0fe66d656" + integrity sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg== dependencies: homedir-polyfill "^1.0.1" @@ -9961,13 +9998,20 @@ which-pm-runs@^1.0.0: resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= -which@^1.2.14, which@^1.2.9, which@~1.3.0: +which@^1.2.14, which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" +which@~2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + wide-align@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" From c2b2a4081e76bd4b60626db07c543f5155a1adf1 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 9 Jan 2023 13:18:56 +0100 Subject: [PATCH 050/299] Composer: update YoastCS and dependencies * YoastCS 2.3.0 has been released. Previous version used was `2.2.1`. Ref: https://github.com/Yoast/yoastcs/releases/tag/2.3.0 * Version 1.0.0 of the Composer PHPCS plugin has been released. Previous version used was `0.7.2`. Ref: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 73253743a..364980302 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/installers": "^1.12.0" }, "require-dev": { - "yoast/yoastcs": "^2.2.1", + "yoast/yoastcs": "^2.3.0", "yoast/wp-test-utils": "^1.1.1", "roave/security-advisories": "dev-master" }, From a58c682346f94b9991ec05a706cefc2ba5074678 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Jan 2023 08:45:50 +0000 Subject: [PATCH 051/299] Bump ua-parser-js from 0.7.31 to 0.7.33 Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.31 to 0.7.33. - [Release notes](https://github.com/faisalman/ua-parser-js/releases) - [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md) - [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.31...0.7.33) --- updated-dependencies: - dependency-name: ua-parser-js dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5fc23fb0e..aa4edccda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5085,9 +5085,10 @@ grunt-git@^1.0.14: dependencies: flopmang "^1.0.0" -"grunt-glotpress@git+https://github.com/Yoast/grunt-glotpress.git#main": +"grunt-glotpress@https://github.com/Yoast/grunt-glotpress.git#main": version "0.3.0" - resolved "git+https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" + uid e6ccc69c2532d126f5d8a30397ffd012e55b6eec + resolved "https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" dependencies: request "^2.88.0" request-promise-native "^1.0.7" @@ -9636,9 +9637,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= ua-parser-js@^0.7.18: - version "0.7.31" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6" - integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ== + version "0.7.33" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532" + integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw== uglify-js@^3.5.0: version "3.12.1" From 6e83b93e787466e1f2fb5843302e44fbcbed5759 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 17 Feb 2023 00:34:34 +0100 Subject: [PATCH 052/299] Fix typo in the HTML of notice --- admin-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-functions.php b/admin-functions.php index e4fde243b..e1537e8de 100644 --- a/admin-functions.php +++ b/admin-functions.php @@ -229,7 +229,7 @@ function duplicate_post_show_update_notice() { echo '
-
+

' . $title . '

' // phpcs:ignore WordPress.Security.EscapeOutput -- Reason: escaped properly above. . Newsletter::newsletter_signup_form() // phpcs:ignore WordPress.Security.EscapeOutput -- Reason: escaped in newsletter.php. . '
From 8b839e8ac194837f2a9f8bd6cdcddb9f82e595af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Mar 2023 04:10:37 +0000 Subject: [PATCH 053/299] Bump minimist from 1.2.5 to 1.2.8 Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.8. - [Release notes](https://github.com/minimistjs/minimist/releases) - [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md) - [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.8) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5fc23fb0e..4dc5c31f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5085,9 +5085,10 @@ grunt-git@^1.0.14: dependencies: flopmang "^1.0.0" -"grunt-glotpress@git+https://github.com/Yoast/grunt-glotpress.git#main": +"grunt-glotpress@https://github.com/Yoast/grunt-glotpress.git#main": version "0.3.0" - resolved "git+https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" + uid e6ccc69c2532d126f5d8a30397ffd012e55b6eec + resolved "https://github.com/Yoast/grunt-glotpress.git#e6ccc69c2532d126f5d8a30397ffd012e55b6eec" dependencies: request "^2.88.0" request-promise-native "^1.0.7" @@ -6615,9 +6616,9 @@ minimalistic-crypto-utils@^1.0.1: brace-expansion "^1.1.7" minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== mississippi@^3.0.0: version "3.0.0" From 98d59b94954dac2c96ff522f0a2ff320a3a1ecd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demarle?= Date: Tue, 14 Mar 2023 19:40:32 +0100 Subject: [PATCH 054/299] Fix deprecated notice when using PHP 8.1+ --- admin-functions.php | 2 +- src/post-duplicator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-functions.php b/admin-functions.php index e1537e8de..87f0291e5 100644 --- a/admin-functions.php +++ b/admin-functions.php @@ -275,7 +275,7 @@ function duplicate_post_copy_post_taxonomies( $new_id, $post ) { global $wpdb; if ( isset( $wpdb->terms ) ) { // Clear default category (added by wp_insert_post). - wp_set_object_terms( $new_id, null, 'category' ); + wp_set_object_terms( $new_id, array(), 'category' ); $post_taxonomies = get_object_taxonomies( $post->post_type ); // Several plugins just add support to post-formats but don't register post_format taxonomy. diff --git a/src/post-duplicator.php b/src/post-duplicator.php index addcd9c26..6d02fc245 100644 --- a/src/post-duplicator.php +++ b/src/post-duplicator.php @@ -187,7 +187,7 @@ public function create_duplicate_for_rewrite_and_republish( WP_Post $post ) { */ public function copy_post_taxonomies( $new_id, $post, $options ) { // Clear default category (added by wp_insert_post). - \wp_set_object_terms( $new_id, null, 'category' ); + \wp_set_object_terms( $new_id, array(), 'category' ); $post_taxonomies = \get_object_taxonomies( $post->post_type ); // Several plugins just add support to post-formats but don't register post_format taxonomy. From 7dd1a9b0f1082b7fbefac7a463efedff02fed480 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Mon, 20 Mar 2023 11:35:09 +0100 Subject: [PATCH 055/299] Drop compatibility with PHP 5.6, 7.0 and 7.1 --- .github/workflows/deploy.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- composer.json | 5 ++++- duplicate-post.php | 2 ++ readme.txt | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0ffe5a1e7..75a227403 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -60,7 +60,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: 5.6 + php-version: 7.2 coverage: none # This action also handles the caching of the Yarn dependencies. diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 870c3886d..1031eccca 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,7 +27,7 @@ jobs: matrix: # Lint against the highest/lowest supported versions of each PHP major. # And also do a run against "nightly" (the current dev version of PHP). - php_version: ['5.6', '7.0', '7.4', '8.0', '8.1', '8.2'] + php_version: ['7.2', '7.4', '8.0', '8.1', '8.2'] name: "Lint: PHP ${{ matrix.php_version }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f17cde555..ad4561b98 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: - php_version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + php_version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] name: "Unit Test: PHP ${{ matrix.php_version }}" diff --git a/composer.json b/composer.json index 364980302..22025dc7e 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "source": "https://github.com/Yoast/duplicate-post" }, "require": { - "php": ">=5.6", + "php": "^7.2.5 || ^8.0", "composer/installers": "^1.12.0" }, "require-dev": { @@ -59,6 +59,9 @@ ] }, "config": { + "platform": { + "php": "7.2.5" + }, "classmap-authoritative": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, diff --git a/duplicate-post.php b/duplicate-post.php index 606847919..3ea104cf8 100644 --- a/duplicate-post.php +++ b/duplicate-post.php @@ -13,6 +13,8 @@ * Author: Enrico Battocchi & Team Yoast * Author URI: https://yoast.com * Text Domain: duplicate-post + * Requires at least: 6.0 + * Requires PHP: 7.2.5 * * Copyright 2020-2022 Yoast BV (email : info@yoast.com) * diff --git a/readme.txt b/readme.txt index fe43cbce3..e55a9bf51 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: duplicate post, copy, clone Requires at least: 6.0 Tested up to: 6.1 Stable tag: 4.5 -Requires PHP: 5.6.20 +Requires PHP: 7.2.5 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html From ad76229915860077cb50581bc11fa1741115ca02 Mon Sep 17 00:00:00 2001 From: Thijs van der Heijden Date: Mon, 20 Mar 2023 15:55:00 +0100 Subject: [PATCH 056/299] Updates author URI. --- duplicate-post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/duplicate-post.php b/duplicate-post.php index 606847919..857a11234 100644 --- a/duplicate-post.php +++ b/duplicate-post.php @@ -11,7 +11,7 @@ * Description: The go-to tool for cloning posts and pages, including the powerful Rewrite & Republish feature. * Version: 4.5 * Author: Enrico Battocchi & Team Yoast - * Author URI: https://yoast.com + * Author URI: https://yoa.st/team-yoast-duplicate * Text Domain: duplicate-post * * Copyright 2020-2022 Yoast BV (email : info@yoast.com) From d19ed4e03fdfca236e201da20fbee7c70d5b5b73 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 21 Mar 2023 11:48:32 +0100 Subject: [PATCH 057/299] Composer: update to YoastCS 2.3.1 The YoastCS `2.3.1` release sets the minimum supported PHP version for the PHPCompatibility checker to `7.2`, which will allow for making code changes which are possible now support for PHP < 7.2 is being dropped. Ref: https://github.com/Yoast/yoastcs/releases/tag/2.3.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 22025dc7e..fe5893448 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/installers": "^1.12.0" }, "require-dev": { - "yoast/yoastcs": "^2.3.0", + "yoast/yoastcs": "^2.3.1", "yoast/wp-test-utils": "^1.1.1", "roave/security-advisories": "dev-master" }, From 8a66f28b5345bfac7de499c0218f032321110531 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 21 Mar 2023 11:52:28 +0100 Subject: [PATCH 058/299] Composer: remove the platform config As this repo does not include a committed `composer.lock` file and does not ship with external dependencies, the `config - platform` requirement in the `composer.json` file is not needed (and would make life more difficult for devs wanting to test the plugin against higher PHP versions). --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index fe5893448..9468caf69 100644 --- a/composer.json +++ b/composer.json @@ -59,9 +59,6 @@ ] }, "config": { - "platform": { - "php": "7.2.5" - }, "classmap-authoritative": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, From 5fd658329bc8722211dba23a8b0c4e8fed7577c6 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 22 Mar 2023 09:29:26 +0100 Subject: [PATCH 059/299] Set the WordPress tested up to version to 6.2 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index fe43cbce3..a5d74fea3 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: yoast, lopo Donate link: https://yoast.com/wordpress/plugins/duplicate-post/ Tags: duplicate post, copy, clone Requires at least: 6.0 -Tested up to: 6.1 +Tested up to: 6.2 Stable tag: 4.5 Requires PHP: 5.6.20 License: GPLv2 or later From d50dceba1d2bb10a699a5f15131ff74fb509c194 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 24 Mar 2023 15:50:21 +0100 Subject: [PATCH 060/299] Fix CS --- admin-functions.php | 2 +- src/post-duplicator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-functions.php b/admin-functions.php index 87f0291e5..28f169ac8 100644 --- a/admin-functions.php +++ b/admin-functions.php @@ -275,7 +275,7 @@ function duplicate_post_copy_post_taxonomies( $new_id, $post ) { global $wpdb; if ( isset( $wpdb->terms ) ) { // Clear default category (added by wp_insert_post). - wp_set_object_terms( $new_id, array(), 'category' ); + wp_set_object_terms( $new_id, [], 'category' ); $post_taxonomies = get_object_taxonomies( $post->post_type ); // Several plugins just add support to post-formats but don't register post_format taxonomy. diff --git a/src/post-duplicator.php b/src/post-duplicator.php index 6d02fc245..3f0320590 100644 --- a/src/post-duplicator.php +++ b/src/post-duplicator.php @@ -187,7 +187,7 @@ public function create_duplicate_for_rewrite_and_republish( WP_Post $post ) { */ public function copy_post_taxonomies( $new_id, $post, $options ) { // Clear default category (added by wp_insert_post). - \wp_set_object_terms( $new_id, array(), 'category' ); + \wp_set_object_terms( $new_id, [], 'category' ); $post_taxonomies = \get_object_taxonomies( $post->post_type ); // Several plugins just add support to post-formats but don't register post_format taxonomy. From fc1d3ed6b48260fdd27348bb19be028eb1927522 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 20 Apr 2023 11:58:30 +0200 Subject: [PATCH 061/299] Set the minimum supported WordPress version to 6.1 --- duplicate-post.php | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/duplicate-post.php b/duplicate-post.php index 713328b0d..06075719d 100644 --- a/duplicate-post.php +++ b/duplicate-post.php @@ -13,7 +13,7 @@ * Author: Enrico Battocchi & Team Yoast * Author URI: https://yoa.st/team-yoast-duplicate * Text Domain: duplicate-post - * Requires at least: 6.0 + * Requires at least: 6.1 * Requires PHP: 7.2.5 * * Copyright 2020-2022 Yoast BV (email : info@yoast.com) diff --git a/readme.txt b/readme.txt index 10ce493b3..a3f57adbb 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: yoast, lopo Donate link: https://yoast.com/wordpress/plugins/duplicate-post/ Tags: duplicate post, copy, clone -Requires at least: 6.0 +Requires at least: 6.1 Tested up to: 6.2 Stable tag: 4.5 Requires PHP: 7.2.5 From 22b5e4aaabe7e4c4c0e7d0a21518122ef9b817b3 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 2 May 2023 02:33:17 +0200 Subject: [PATCH 062/299] README: improve maintainability of badges --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4b0c0354d..80369cb8f 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,15 @@ ![Banner](svn-assets/banner-772x250.png) -[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/duplicate-post.svg)](https://wordpress.org/plugins/duplicate-post/) ![WordPress Plugin: Tested WP Version](https://img.shields.io/wordpress/plugin/tested/duplicate-post.svg) [![WordPress Plugin Active Installs](https://img.shields.io/wordpress/plugin/installs/duplicate-post.svg)](https://wordpress.org/plugins/duplicate-post/advanced/) [![WordPress Plugin Downloads](https://img.shields.io/wordpress/plugin/dt/duplicate-post.svg)](https://wordpress.org/plugins/duplicate-post/advanced/) [![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/stars/duplicate-post.svg)](https://wordpress.org/support/plugin/duplicate-post/reviews/) [![GitHub](https://img.shields.io/github/license/Yoast/duplicate-post.svg)](https://github.com/Yoast/duplicate-post/blob/future/LICENSE) [![Build Status](https://travis-ci.org/Yoast/duplicate-post.svg?branch=develop)](https://travis-ci.org/Yoast/duplicate-post) - -> Duplicate Post plugin for WordPress https://yoast.com/wordpress/plugins/duplicate-post/ +[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/duplicate-post.svg)](https://wordpress.org/plugins/duplicate-post/) +![WordPress Plugin: Tested WP Version](https://img.shields.io/wordpress/plugin/tested/duplicate-post.svg) +[![WordPress Plugin Active Installs](https://img.shields.io/wordpress/plugin/installs/duplicate-post.svg)](https://wordpress.org/plugins/duplicate-post/advanced/) +[![WordPress Plugin Downloads](https://img.shields.io/wordpress/plugin/dt/duplicate-post.svg)](https://wordpress.org/plugins/duplicate-post/advanced/) +[![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/stars/duplicate-post.svg)](https://wordpress.org/support/plugin/duplicate-post/reviews/) +[![GitHub](https://img.shields.io/github/license/Yoast/duplicate-post.svg)](https://github.com/Yoast/duplicate-post/blob/future/LICENSE) +[![Build Status](https://travis-ci.org/Yoast/duplicate-post.svg?branch=develop)](https://travis-ci.org/Yoast/duplicate-post) + +> Duplicate Post plugin for WordPress https://yoast.com/wordpress/plugins/duplicate-post/ This WordPress plugin allows users to clone posts of any type, or copy them to new drafts for further editing. From a6a3ccefd7cdcd92e1014297960f443de86da0f4 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 2 May 2023 02:34:25 +0200 Subject: [PATCH 063/299] README: fix broken build status badge ... by replacing it with a group of badges referring to the status of the GH Actions workflows. --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 80369cb8f..f0103c66e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,11 @@ [![WordPress Plugin Downloads](https://img.shields.io/wordpress/plugin/dt/duplicate-post.svg)](https://wordpress.org/plugins/duplicate-post/advanced/) [![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/stars/duplicate-post.svg)](https://wordpress.org/support/plugin/duplicate-post/reviews/) [![GitHub](https://img.shields.io/github/license/Yoast/duplicate-post.svg)](https://github.com/Yoast/duplicate-post/blob/future/LICENSE) -[![Build Status](https://travis-ci.org/Yoast/duplicate-post.svg?branch=develop)](https://travis-ci.org/Yoast/duplicate-post) + +[![CS](https://github.com/Yoast/duplicate-post/actions/workflows/cs.yml/badge.svg)](https://github.com/Yoast/duplicate-post/actions/workflows/cs.yml) +[![Lint](https://github.com/Yoast/duplicate-post/actions/workflows/lint.yml/badge.svg)](https://github.com/Yoast/duplicate-post/actions/workflows/lint.yml) +[![Test](https://github.com/Yoast/duplicate-post/actions/workflows/test.yml/badge.svg)](https://github.com/Yoast/duplicate-post/actions/workflows/test.yml) +[![Deployment](https://github.com/Yoast/duplicate-post/actions/workflows/deploy.yml/badge.svg)](https://github.com/Yoast/duplicate-post/actions/workflows/deploy.yml) > Duplicate Post plugin for WordPress https://yoast.com/wordpress/plugins/duplicate-post/ From c868f2176db1dca896e78b352faf483d4ff2d552 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 2 May 2023 02:47:47 +0200 Subject: [PATCH 064/299] CI/QA: start recording code coverage This commit makes the necessary changes to start recording and uploading code coverage data to Coveralls. Includes: * Updating the GH Actions `test` workflow to run the high/low PHP version builds with code coverage and upload the results. * Updating the PHPUnit config to show an inline code coverage summary and improve the `filter` configuration. * Ignoring the potentially generated code coverage files in the `build/*` directory to prevent it being committed. * Adding a code coverage badge to the README. Not included as already in place: * Adding a script to the `composer.json` file to run code coverage. Notes: * Coverage will be recorded using `Xdebug` as the code coverage driver. * Recording code coverage can be slow and it is not needed to run it on each build to still get a good idea of the code coverage. With that in mind, code coverage is only recorded for high/low PHP. * The `php-coveralls/php-coveralls` package is used to convert the coverage information from a format as generated by PHPUnit to a format as can be consumed by Coveralls. - As this package is only needed for the upload to Coveralls, the package has **not** been added it to the `composer.json` file, but will be (global) installed in the GH Actions workflow only. - The `php-coveralls/php-coveralls` package is not 100% compatible with PHP 8.x (yet), so for uploading the coverage generated using PHP 8.x, we switch to PHP 7.4 for uploading the code coverage reports. * Coveralls requires a token to identify the repo and prevent unauthorized uploads. This token has been added to the repository secrets. People with admin access to the GH repo automatically also have access to the admin settings in Coveralls. If ever needed, the Coveralls token can be found (and regenerated) in the Coveralls admin for a repo. After regeneration, the token as stored in the GH repo Settings -> Secrets and Variables -> Actions -> Repository secrets should be updated. * As the workflow sends multiple code coverage reports to Coveralls, we need to tell it to process those reports in parallel and give each report a unique name. That's what the `COVERALLS_PARALLEL` and COVERALLS_FLAG_NAME` settings are about. * The `coveralls-finish` job will signal to Coveralls that all reports have been uploaded. This basically gives the "okay" to Coveralls to report on the changes in code coverage via a comment on a GitHub PR as well as via a status check. The pertinent Coveralls settings used for this repo are: * "Only send aggregate Coverage updates to SCM": enabled * "Leave comments": enabled * "(Comment) Format": detailed * "Use Status API": enabled * "Coverage threshold for failure": 35% * "Coverage decrease threshold for failure": 2.0% --- .github/workflows/test.yml | 49 ++++++++++++++++++++++++++++++++++++-- .gitignore | 2 ++ README.md | 1 + phpunit.xml.dist | 11 +++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad4561b98..374979f37 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,15 @@ jobs: strategy: matrix: - php_version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + php_version: ['7.3', '7.4', '8.0', '8.1'] + coverage: [false] + + # Run code coverage only on high/low PHP. + include: + - php_version: 7.2 + coverage: true + - php_version: 8.2 + coverage: true name: "Unit Test: PHP ${{ matrix.php_version }}" @@ -38,7 +46,7 @@ jobs: with: php-version: ${{ matrix.php_version }} ini-values: zend.assertions=1, error_reporting=-1, display_errors=On - coverage: none + coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }} # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies @@ -49,4 +57,41 @@ jobs: custom-cache-suffix: $(date -u "+%Y-%m") - name: Run unit tests + if: ${{ matrix.coverage == false }} run: composer test + + - name: Run the unit tests with code coverage + if: ${{ matrix.coverage == true }} + run: composer coverage + + # PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version. + - name: Switch to PHP 7.4 + if: ${{ success() && matrix.coverage == true && startsWith( matrix.php_version, '8' ) }} + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + coverage: none + + # Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+. + - name: Install Coveralls + if: ${{ success() && matrix.coverage == true }} + run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction + + - name: Upload coverage results to Coveralls + if: ${{ success() && matrix.coverage == true }} + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: php-${{ matrix.php_version }} + run: php-coveralls -v -x build/logs/clover.xml + + coveralls-finish: + needs: unit + runs-on: ubuntu-latest + + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.COVERALLS_TOKEN }} + parallel-finished: true diff --git a/.gitignore b/.gitignore index f5a06fe59..909d53deb 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ tests/cli/vendor /tests/bin/tmp /tests/e2e-tests/config/local-*.json /tests/e2e-tests/config/local.json +build/ ############ ## Composer @@ -54,6 +55,7 @@ phpcs.xml .cache/phpcs.cache phpunit.xml .phpunit.result.cache + ############ # Temp files ############ diff --git a/README.md b/README.md index f0103c66e..0afb757f5 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ [![Lint](https://github.com/Yoast/duplicate-post/actions/workflows/lint.yml/badge.svg)](https://github.com/Yoast/duplicate-post/actions/workflows/lint.yml) [![Test](https://github.com/Yoast/duplicate-post/actions/workflows/test.yml/badge.svg)](https://github.com/Yoast/duplicate-post/actions/workflows/test.yml) [![Deployment](https://github.com/Yoast/duplicate-post/actions/workflows/deploy.yml/badge.svg)](https://github.com/Yoast/duplicate-post/actions/workflows/deploy.yml) +[![Coverage Status](https://coveralls.io/repos/github/Yoast/duplicate-post/badge.svg?branch=trunk)](https://coveralls.io/github/Yoast/duplicate-post?branch=trunk) > Duplicate Post plugin for WordPress https://yoast.com/wordpress/plugins/duplicate-post/ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fb6dd91c3..15e92b5ea 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -26,7 +26,18 @@ + ./admin-functions.php + ./common-functions.php + ./duplicate-post.php + ./options.php + ./compat ./src + + + + + + From c0e0d6fc305ad2fc5b0eb75a041a0a8ce5eef138 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 24 Mar 2023 15:32:42 +0100 Subject: [PATCH 065/299] Dependabot: add reviewer config The Dependabot PRs can have a tendency to stay open for a long time, while for the GH Actions related ones I keep an eye on all used action runner releases anyway. However, I don't "watch" all Yoast repos, so adding this configuration will ensure that I get notified about Dependabot PRs related to GH Actions action runners for this repo (and can merge it if appropriate). --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 50e0ff7ad..4afea14d5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,3 +16,5 @@ updates: labels: - "changelog: non-user-facing" - "yoast cs/qa" + reviewers: + - "jrfnl" From 2e955072185ec6acdd7a6bb2866f958b89b1dee0 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 14 May 2023 08:38:22 +0200 Subject: [PATCH 066/299] GH Actions: run workflows more selectively Only run the workflows when there is a chance that the result of the workflow run will be different from before. The path selection is set up to cast a wide net to make the risk of the workflows not running when the build could potentially break as small as possible. This means that, aside from files of the type being checked in the workflow changing, the workflow will also run when: * The configuration used changes. * Dependencies used in the workflow may potentially have changed. * Composer scripts used in the workflow may potentially have changed. * Shell scripts used in the workflow have changed. * The workflow itself changes. * Miscellaneous related files have changed. Note: the lists of files _may_ include some files which don't currently exist in the repo (like `.eslintignore`) for consistency across workflows and to prevent issues if/when such file(s) would be introduced to the repo. Also note that, as this repo does not contain a committed `composer.lock` file, the path selection is done via `paths-ignore` instead of via `paths`! --- .github/workflows/cs.yml | 46 ++++++++++++++++++++++++++++++++++- .github/workflows/lint.yml | 50 +++++++++++++++++++++++++++++++++++++- .github/workflows/test.yml | 48 +++++++++++++++++++++++++++++++++++- 3 files changed, 141 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index bdf317226..6738b8b40 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -1,11 +1,55 @@ name: CS on: - # Run on all pushes (except to main) and on all pull requests. + # Run on all relevant pushes (except to main) and on all relevant pull requests. push: branches-ignore: - 'main' + paths-ignore: + - '**.css' + - '**.js' + - '**.md' + - '**.png' + - '**.txt' + - '.babelrc' + - '.editorconfig' + - '.gitattributes' + - '.gitignore' + - 'CHANGELOG' + - 'LICENSE' + - 'package.json' + - 'phpunit.xml.dist' + - 'yarn.lock' + - '.github/dependabot.yml' + - '.github/workflows/deploy.yml' + - '.github/workflows/lint.yml' + - '.github/workflows/test.yml' + - 'config/**' + - 'css/**' + - 'js/**' pull_request: + paths-ignore: + - '**.css' + - '**.js' + - '**.md' + - '**.png' + - '**.txt' + - '.babelrc' + - '.editorconfig' + - '.gitattributes' + - '.gitignore' + - 'CHANGELOG' + - 'LICENSE' + - 'package.json' + - 'phpunit.xml.dist' + - 'yarn.lock' + - '.github/dependabot.yml' + - '.github/workflows/deploy.yml' + - '.github/workflows/lint.yml' + - '.github/workflows/test.yml' + - 'config/**' + - 'css/**' + - 'js/**' # Allow manually triggering the workflow. workflow_dispatch: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1031eccca..cc0795188 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,7 @@ name: Lint on: - # Run on pushes to select branches and on all pull requests. + # Run on relevant pushes to select branches and on all relevant pull requests. push: branches: - main @@ -9,7 +9,55 @@ on: - 'release/**' - 'hotfix/[0-9]+.[0-9]+*' - 'feature/**' + paths-ignore: + - '**.css' + - '**.js' + - '**.md' + - '**.png' + - '**.txt' + - '.babelrc' + - '.editorconfig' + - '.gitattributes' + - '.gitignore' + - 'CHANGELOG' + - 'LICENSE' + - 'package.json' + - '.phpcs.xml.dist' + - 'phpcs.xml.dist' + - 'phpunit.xml.dist' + - 'yarn.lock' + - '.github/dependabot.yml' + - '.github/workflows/cs.yml' + - '.github/workflows/deploy.yml' + - '.github/workflows/test.yml' + - 'config/**' + - 'css/**' + - 'js/**' pull_request: + paths-ignore: + - '**.css' + - '**.js' + - '**.md' + - '**.png' + - '**.txt' + - '.babelrc' + - '.editorconfig' + - '.gitattributes' + - '.gitignore' + - 'CHANGELOG' + - 'LICENSE' + - 'package.json' + - '.phpcs.xml.dist' + - 'phpcs.xml.dist' + - 'phpunit.xml.dist' + - 'yarn.lock' + - '.github/dependabot.yml' + - '.github/workflows/cs.yml' + - '.github/workflows/deploy.yml' + - '.github/workflows/test.yml' + - 'config/**' + - 'css/**' + - 'js/**' # Allow manually triggering the workflow. workflow_dispatch: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 374979f37..c8b0d8830 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: - # Run on pushes to select branches and on all pull requests. + # Run on relevant pushes to select branches and on all relevant pull requests. push: branches: - main @@ -9,7 +9,53 @@ on: - 'release/**' - 'hotfix/[0-9]+.[0-9]+*' - 'feature/**' + paths-ignore: + - '**.css' + - '**.js' + - '**.md' + - '**.png' + - '**.txt' + - '.babelrc' + - '.editorconfig' + - '.gitattributes' + - '.gitignore' + - 'CHANGELOG' + - 'LICENSE' + - 'package.json' + - '.phpcs.xml.dist' + - 'phpcs.xml.dist' + - 'yarn.lock' + - '.github/dependabot.yml' + - '.github/workflows/cs.yml' + - '.github/workflows/deploy.yml' + - '.github/workflows/lint.yml' + - 'config/**' + - 'css/**' + - 'js/**' pull_request: + paths-ignore: + - '**.css' + - '**.js' + - '**.md' + - '**.png' + - '**.txt' + - '.babelrc' + - '.editorconfig' + - '.gitattributes' + - '.gitignore' + - 'CHANGELOG' + - 'LICENSE' + - 'package.json' + - '.phpcs.xml.dist' + - 'phpcs.xml.dist' + - 'yarn.lock' + - '.github/dependabot.yml' + - '.github/workflows/cs.yml' + - '.github/workflows/deploy.yml' + - '.github/workflows/lint.yml' + - 'config/**' + - 'css/**' + - 'js/**' # Allow manually triggering the workflow. workflow_dispatch: From c70a6e598e48c4b8df73727b185ec82cbe8d5556 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 04:16:55 +0000 Subject: [PATCH 067/299] Bump semver from 5.7.1 to 5.7.2 Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/yarn.lock b/yarn.lock index 65e8a00cd..751b599fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6632,7 +6632,7 @@ minimalistic-crypto-utils@^1.0.1: dependencies: brace-expansion "^1.1.7" -minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: +minimist@^1.1.3, minimist@^1.2.3, minimist@^1.2.5: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -8820,14 +8820,14 @@ semver-truncate@^1.1.2: semver "^5.3.0" "semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== serialize-javascript@^4.0.0: version "4.0.0" From 1648c74b61f71b4388c219048b25a0d2750d5069 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 00:45:07 +0000 Subject: [PATCH 068/299] Bump word-wrap from 1.2.3 to 1.2.4 Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4. - [Release notes](https://github.com/jonschlinkert/word-wrap/releases) - [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4) --- updated-dependencies: - dependency-name: word-wrap dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 65e8a00cd..4deada51f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6632,7 +6632,7 @@ minimalistic-crypto-utils@^1.0.1: dependencies: brace-expansion "^1.1.7" -minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: +minimist@^1.1.3, minimist@^1.2.3, minimist@^1.2.5: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -10025,9 +10025,9 @@ wide-align@^1.1.0: string-width "^1.0.2 || 2" word-wrap@~1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + version "1.2.4" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f" + integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA== worker-farm@^1.7.0: version "1.7.0" From 132cfc32d3079711089493140d037418c6dafdf1 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 4 Aug 2023 14:15:57 +0200 Subject: [PATCH 069/299] Set the WordPress tested up to version to 6.3 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index a3f57adbb..db7f90ac5 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: yoast, lopo Donate link: https://yoast.com/wordpress/plugins/duplicate-post/ Tags: duplicate post, copy, clone Requires at least: 6.1 -Tested up to: 6.2 +Tested up to: 6.3 Stable tag: 4.5 Requires PHP: 7.2.5 License: GPLv2 or later From 5821caaaf1b154788aa27cf8d0fb1b31cb471219 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 30 Aug 2023 22:36:08 +0200 Subject: [PATCH 070/299] Set the minimum supported WordPress version to 6.2 --- duplicate-post.php | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/duplicate-post.php b/duplicate-post.php index 06075719d..a514e4c2d 100644 --- a/duplicate-post.php +++ b/duplicate-post.php @@ -13,7 +13,7 @@ * Author: Enrico Battocchi & Team Yoast * Author URI: https://yoa.st/team-yoast-duplicate * Text Domain: duplicate-post - * Requires at least: 6.1 + * Requires at least: 6.2 * Requires PHP: 7.2.5 * * Copyright 2020-2022 Yoast BV (email : info@yoast.com) diff --git a/readme.txt b/readme.txt index db7f90ac5..645d40982 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: yoast, lopo Donate link: https://yoast.com/wordpress/plugins/duplicate-post/ Tags: duplicate post, copy, clone -Requires at least: 6.1 +Requires at least: 6.2 Tested up to: 6.3 Stable tag: 4.5 Requires PHP: 7.2.5 From 5e60d9c29aef51baa3c2ebff2e584e5f2374bcb5 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 22 Sep 2023 08:31:30 +0200 Subject: [PATCH 071/299] Create config.yml for issue templates --- .github/ISSUE_TEMPLATE/config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..3ba13e0ce --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false From 4682d0a2fa6c502c7b4dd047d2144cd107532745 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 22 Sep 2023 08:32:31 +0200 Subject: [PATCH 072/299] Add feature request template --- .github/ISSUE_TEMPLATE/Feature_request.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/Feature_request.md diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 000000000..78f0ff2c8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,15 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + + + +## Is your feature request related to a problem? Please describe. + +## Describe the solution you'd like + +## Why do you think this feature is something we should consider for the Yoast SEO plugins? + +## Additional context From 047390ca072f54c5f9bc0a792271326f3b6c9245 Mon Sep 17 00:00:00 2001 From: Jeroen Rotty Date: Tue, 26 Sep 2023 13:53:11 +0200 Subject: [PATCH 073/299] Update readme.txt Fixes one 404 in our readme and changes one other link text --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 645d40982..c3e3fa7b6 100644 --- a/readme.txt +++ b/readme.txt @@ -31,7 +31,7 @@ How it works: There is also a **template tag**, so you can put it in your templates and clone your posts/pages from the front-end. Clicking on the link will lead you to the edit page for the new draft, just like the admin bar link. -Duplicate Post has many useful settings to customize its behavior and restrict its use to certain roles or post types. Check out the extensive documentation [on yoast.com](https://yoast.com/wordpress/plugins/duplicate-post/) and our [developer docs](https://developer.yoast.com/duplicate-post/). +Duplicate Post has many useful settings to customize its behavior and restrict its use to certain roles or post types. Check out the extensive documentation [yoast.com](https://yoast.com/wordpress/plugins/duplicate-post/) and our [developer docs](https://developer.yoast.com/duplicate-post/overview/). == Installation == From 5e045674d507082faca3057399498c620e4c9465 Mon Sep 17 00:00:00 2001 From: Jeroen Rotty Date: Tue, 26 Sep 2023 13:55:50 +0200 Subject: [PATCH 074/299] Update readme.txt Adds "on" back to the first link. --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index c3e3fa7b6..6301c193a 100644 --- a/readme.txt +++ b/readme.txt @@ -31,7 +31,7 @@ How it works: There is also a **template tag**, so you can put it in your templates and clone your posts/pages from the front-end. Clicking on the link will lead you to the edit page for the new draft, just like the admin bar link. -Duplicate Post has many useful settings to customize its behavior and restrict its use to certain roles or post types. Check out the extensive documentation [yoast.com](https://yoast.com/wordpress/plugins/duplicate-post/) and our [developer docs](https://developer.yoast.com/duplicate-post/overview/). +Duplicate Post has many useful settings to customize its behavior and restrict its use to certain roles or post types. Check out the extensive documentation on [yoast.com](https://yoast.com/wordpress/plugins/duplicate-post/) and our [developer docs](https://developer.yoast.com/duplicate-post/overview/). == Installation == From ce1617e58e9e4ef04a72855482ce36407490af32 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 22 Sep 2023 14:22:33 +0200 Subject: [PATCH 075/299] .gitattributes: minor clean up * Alignment for readability. * Sorted the list - folders first, then files, alphabetic order. * Remove files which don't exist in this repo from the list. --- .gitattributes | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/.gitattributes b/.gitattributes index b8093c266..bbdd753cf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,25 +5,22 @@ # https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production # https://blog.madewithlove.be/post/gitattributes/ # -.babelrc export-ignore -.editorconfig export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.phpcs.xml.dist export-ignore -CHANGELOG export-ignore -Gruntfile.js export-ignore -LICENSE export-ignore -package.json export-ignore -package-lock.json export-ignore -phpunit.* export-ignore -README.md export-ignore -README.wordpress.md export-ignore -/.cache export-ignore -/.github export-ignore -assets export-ignore -dist export-ignore -svn-assets export-ignore -tests export-ignore +/.cache export-ignore +/.github export-ignore +/config export-ignore +/svn-assets export-ignore +/tests export-ignore +.babelrc export-ignore +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.phpcs.xml.dist export-ignore +CHANGELOG export-ignore +Gruntfile.js export-ignore +LICENSE export-ignore +package.json export-ignore +phpunit.xml.dist export-ignore +README.md export-ignore # # Auto detect text files and perform LF normalization From f8a51b406fc99aa57edaf1cc50303b307b5fd51b Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 24 Sep 2023 12:46:18 +0200 Subject: [PATCH 076/299] PHPUnit config: update schema reference ... to the minimum PHPUnit version which is currently in use. The configuration has also been validates against the schema and where needed, updated. --- phpunit.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 15e92b5ea..2c132cba2 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ Date: Thu, 29 Jun 2023 18:53:20 +0200 Subject: [PATCH 077/299] Move unit tests to `unit` folder --- phpunit.xml.dist | 4 ++-- tests/{ => unit}/admin/options-form-generator-test.php | 4 ++-- tests/{ => unit}/admin/options-inputs-test.php | 4 ++-- tests/{ => unit}/admin/options-page-test.php | 4 ++-- tests/{ => unit}/admin/options-test.php | 4 ++-- tests/{ => unit}/bootstrap.php | 6 +++--- tests/{ => unit}/handlers/check-changes-handler-test.php | 4 ++-- tests/{ => unit}/permissions-helper-test.php | 2 +- tests/{ => unit}/post-duplicator-test.php | 2 +- tests/{ => unit}/post-republisher-test.php | 2 +- tests/{ => unit}/revisions-migrator-test.php | 2 +- tests/{ => unit}/testcase.php | 2 +- tests/{ => unit}/ui/admin-bar-test.php | 4 ++-- tests/{ => unit}/ui/asset-manager-test.php | 4 ++-- tests/{ => unit}/ui/block-editor-test.php | 4 ++-- tests/{ => unit}/ui/bulk-actions-test.php | 4 ++-- tests/{ => unit}/ui/classic-editor-test.php | 4 ++-- tests/{ => unit}/ui/column-test.php | 4 ++-- tests/{ => unit}/ui/link-builder-test.php | 4 ++-- tests/{ => unit}/ui/metabox-test.php | 4 ++-- tests/{ => unit}/ui/post-states-test.php | 4 ++-- tests/{ => unit}/ui/row-actions-test.php | 4 ++-- tests/{ => unit}/utils-test.php | 2 +- tests/{ => unit}/watchers/bulk-actions-watcher-test.php | 4 ++-- tests/{ => unit}/watchers/copied-post-watcher-test.php | 4 ++-- tests/{ => unit}/watchers/link-actions-watcher-test.php | 4 ++-- tests/{ => unit}/watchers/original-post-watcher-test.php | 4 ++-- tests/{ => unit}/watchers/republished-post-watcher-test.php | 4 ++-- 28 files changed, 51 insertions(+), 51 deletions(-) rename tests/{ => unit}/admin/options-form-generator-test.php (99%) rename tests/{ => unit}/admin/options-inputs-test.php (95%) rename tests/{ => unit}/admin/options-page-test.php (97%) rename tests/{ => unit}/admin/options-test.php (97%) rename tests/{ => unit}/bootstrap.php (76%) rename tests/{ => unit}/handlers/check-changes-handler-test.php (98%) rename tests/{ => unit}/permissions-helper-test.php (99%) rename tests/{ => unit}/post-duplicator-test.php (99%) rename tests/{ => unit}/post-republisher-test.php (99%) rename tests/{ => unit}/revisions-migrator-test.php (98%) rename tests/{ => unit}/testcase.php (97%) rename tests/{ => unit}/ui/admin-bar-test.php (99%) rename tests/{ => unit}/ui/asset-manager-test.php (98%) rename tests/{ => unit}/ui/block-editor-test.php (99%) rename tests/{ => unit}/ui/bulk-actions-test.php (98%) rename tests/{ => unit}/ui/classic-editor-test.php (99%) rename tests/{ => unit}/ui/column-test.php (97%) rename tests/{ => unit}/ui/link-builder-test.php (98%) rename tests/{ => unit}/ui/metabox-test.php (97%) rename tests/{ => unit}/ui/post-states-test.php (98%) rename tests/{ => unit}/ui/row-actions-test.php (99%) rename tests/{ => unit}/utils-test.php (97%) rename tests/{ => unit}/watchers/bulk-actions-watcher-test.php (98%) rename tests/{ => unit}/watchers/copied-post-watcher-test.php (98%) rename tests/{ => unit}/watchers/link-actions-watcher-test.php (98%) rename tests/{ => unit}/watchers/original-post-watcher-test.php (98%) rename tests/{ => unit}/watchers/republished-post-watcher-test.php (98%) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2c132cba2..2a4179710 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,7 +4,7 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd" backupGlobals="false" backupStaticAttributes="false" - bootstrap="tests/bootstrap.php" + bootstrap="tests/unit/bootstrap.php" colors="true" convertDeprecationsToExceptions="true" convertErrorsToExceptions="true" @@ -20,7 +20,7 @@ > - ./tests/ + ./tests/unit diff --git a/tests/admin/options-form-generator-test.php b/tests/unit/admin/options-form-generator-test.php similarity index 99% rename from tests/admin/options-form-generator-test.php rename to tests/unit/admin/options-form-generator-test.php index 297e64660..81b90aa65 100644 --- a/tests/admin/options-form-generator-test.php +++ b/tests/unit/admin/options-form-generator-test.php @@ -1,6 +1,6 @@ Date: Thu, 29 Jun 2023 18:53:57 +0200 Subject: [PATCH 078/299] Add integration tests folder with a proof-of-concept test --- .phpcs.xml.dist | 8 +++ phpunit-integration.xml.dist | 43 +++++++++++++ tests/integration/bootstrap.php | 73 ++++++++++++++++++++++ tests/integration/post-duplicator-test.php | 54 ++++++++++++++++ 4 files changed, 178 insertions(+) create mode 100644 phpunit-integration.xml.dist create mode 100644 tests/integration/bootstrap.php create mode 100644 tests/integration/post-duplicator-test.php diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 9cb8f12f3..ed678c575 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -89,6 +89,9 @@ + + + @@ -109,6 +112,11 @@ + + /tests/*/bootstrap\.php$ + + + /tests/*\.php$ diff --git a/phpunit-integration.xml.dist b/phpunit-integration.xml.dist new file mode 100644 index 000000000..440a3050a --- /dev/null +++ b/phpunit-integration.xml.dist @@ -0,0 +1,43 @@ + + + + + ./tests/integration + + + + + + ./admin-functions.php + ./common-functions.php + ./duplicate-post.php + ./options.php + ./compat + ./src + + + + + + + + + diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php new file mode 100644 index 000000000..71a9ae55f --- /dev/null +++ b/tests/integration/bootstrap.php @@ -0,0 +1,73 @@ + 'Yoast Duplicate Post', + 'organisation' => 'Yoast', + 'repo_slug' => 'duplicate-post', + 'api_key' => false, + 'private' => true, +]; + +if ( getenv( 'GITHUB_API_KEY' ) !== false ) { + $GLOBALS['github_repo']['api_key'] = getenv( 'GITHUB_API_KEY' ); +} + +if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) ) { + define( 'WP_TESTS_FORCE_KNOWN_BUGS', ( getenv( 'WP_TESTS_FORCE_KNOWN_BUGS' ) === '1' ) ); +} + +if ( ! defined( 'YOAST_DUPLICATE_POST_TEST_ROOT_DIR' ) ) { + define( 'YOAST_DUPLICATE_POST_TEST_ROOT_DIR', __DIR__ . '/' ); // Includes trailing slash. +} + +/* + * Load the plugin(s). + */ +require_once dirname( dirname( __DIR__ ) ) . '/vendor/yoast/wp-test-utils/src/WPIntegration/bootstrap-functions.php'; + +$GLOBALS['wp_tests_options'] = [ + 'active_plugins' => [ + 'duplicate-post/duplicate-post', + ], +]; + +$_wp_tests_dir = WPIntegration\get_path_to_wp_test_dir(); +if ( $_wp_tests_dir === false ) { + $_wp_tests_dir = YOAST_DUPLICATE_POST_TEST_ROOT_DIR . '../../../../tests/phpunit/'; +} + + +// Load some helpful functions. +require_once $_wp_tests_dir . 'includes/functions.php'; + +/** + * Activates this plugin in WordPress so it can be tested. + */ +function _manually_load_plugin() { + require YOAST_DUPLICATE_POST_TEST_ROOT_DIR . '../../duplicate-post.php'; +} + +tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); + +/* + * Load WordPress, which will load the Composer autoload file, and load the MockObject autoloader after that. + */ +WPIntegration\bootstrap_it(); diff --git a/tests/integration/post-duplicator-test.php b/tests/integration/post-duplicator-test.php new file mode 100644 index 000000000..68681bd71 --- /dev/null +++ b/tests/integration/post-duplicator-test.php @@ -0,0 +1,54 @@ +instance = new Post_Duplicator(); + } + + /** + * Tests whether the admin page is generated correctly. + * + * @covers ::create_duplicate + * @covers ::get_default_options + * @covers ::generate_copy_title + * @covers ::generate_copy_status + * @covers ::generate_copy_author + */ + public function test_create_duplicate() { + + $post = $this->factory->post->create_and_get(); + + $id = $this->instance->create_duplicate( $post ); + + $this->assertTrue( \is_int( $id ) ); + } +} From f555197735b78e783bd1a8eeefb9344e491fd5b1 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 29 Jun 2023 18:54:20 +0200 Subject: [PATCH 079/299] Introduce composer commands for integration tests --- composer.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composer.json b/composer.json index 9468caf69..5bb9d8310 100644 --- a/composer.json +++ b/composer.json @@ -56,6 +56,12 @@ ], "coverage": [ "@php ./vendor/phpunit/phpunit/phpunit" + ], + "integration-test": [ + "@php ./vendor/phpunit/phpunit/phpunit -c phpunit-integration.xml.dist --no-coverage" + ], + "integration-coverage": [ + "@php ./vendor/phpunit/phpunit/phpunit -c phpunit-integration.xml.dist" ] }, "config": { From 5db1668268ed48ab489131e998c8c6f7145b0625 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 29 Jun 2023 18:54:34 +0200 Subject: [PATCH 080/299] Add integration tests to GH actions --- .github/workflows/test.yml | 83 +++++++++++++ config/scripts/install-wp-tests.sh | 189 +++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+) create mode 100755 config/scripts/install-wp-tests.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8b0d8830..0fd730be9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -131,6 +131,89 @@ jobs: COVERALLS_FLAG_NAME: php-${{ matrix.php_version }} run: php-coveralls -v -x build/logs/clover.xml + integration-test: + runs-on: ubuntu-latest + + strategy: + matrix: + php_version: [ '7.3', '7.4', '8.0', '8.1' ] + coverage: [ false ] + + # Run code coverage only on high/low PHP. + include: + - php_version: 7.2 + coverage: true + - php_version: 8.2 + coverage: true + + name: "Integration Test: PHP ${{ matrix.php_version }}" + + # Allow builds to fail on as-of-yet unreleased WordPress versions. + continue-on-error: ${{ matrix.wp_version == 'trunk' }} + + services: + mysql: + # Use MySQL 5.6 for PHP 7.2, use MySQL 5.7 for PHP 7.3 < 7.4, otherwise MySQL 8.0. + # Also see: https://core.trac.wordpress.org/ticket/52496 + image: mysql:${{ ( matrix.php_version == '7.2' && '5.6' ) || ( matrix.php_version < '7.4' && '5.7' ) || '8.0' }} + env: + MYSQL_ALLOW_EMPTY_PASSWORD: false + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_version }} + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On + coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }} + + # Install dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: Install Composer dependencies + uses: ramsey/composer-install@v2 + with: + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") + + - name: Install WP + shell: bash + run: config/scripts/install-wp-tests.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp_version }} + + - name: Run integration tests + if: ${{ matrix.coverage == false }} + run: composer integration-test + + - name: Run integration tests with code coverage + if: ${{ matrix.coverage == true }} + run: composer integration-coverage + + # PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version. + - name: Switch to PHP 7.4 + if: ${{ success() && matrix.coverage == true && startsWith( matrix.php_version, '8' ) }} + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + coverage: none + + # Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+. + - name: Install Coveralls + if: ${{ success() && matrix.coverage == true }} + run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction + + - name: Upload coverage results to Coveralls + if: ${{ success() && matrix.coverage == true }} + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: intgr-php-${{ matrix.php_version }} + run: php-coveralls -v -x build/logs/clover-integration.xml + coveralls-finish: needs: unit runs-on: ubuntu-latest diff --git a/config/scripts/install-wp-tests.sh b/config/scripts/install-wp-tests.sh new file mode 100755 index 000000000..8c0004eee --- /dev/null +++ b/config/scripts/install-wp-tests.sh @@ -0,0 +1,189 @@ +#!/usr/bin/env bash + +######################################################################## +# Script to download and install WordPress for use in automated testing. +# +# Source: https://github.com/wp-cli/scaffold-command/blob/main/templates/install-wp-tests.sh +# Last updated based on commit https://github.com/wp-cli/scaffold-command/commit/503ac569875d3665a0b28b9a5b7e8d136112b6d6 +# dated December 15 2022. +######################################################################## + +if [ $# -lt 3 ]; then + echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" + exit 1 +fi + +DB_NAME=$1 +DB_USER=$2 +DB_PASS=$3 +DB_HOST=${4-localhost} +WP_VERSION=${5-latest} +SKIP_DB_CREATE=${6-false} + +TMPDIR=${TMPDIR-/tmp} +TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") +WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} +WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress} + +download() { + if [ `which curl` ]; then + curl -s "$1" > "$2"; + elif [ `which wget` ]; then + wget -nv -O "$2" "$1" + fi +} + +if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then + WP_BRANCH=${WP_VERSION%\-*} + WP_TESTS_TAG="branches/$WP_BRANCH" + +elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then + WP_TESTS_TAG="branches/$WP_VERSION" +elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + WP_TESTS_TAG="tags/${WP_VERSION%??}" + else + WP_TESTS_TAG="tags/$WP_VERSION" + fi +elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + WP_TESTS_TAG="trunk" +else + # http serves a single offer, whereas https serves multiple. we only want one + download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json + LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + if [[ -z "$LATEST_VERSION" ]]; then + echo "Latest WordPress version could not be found" + exit 1 + fi + WP_TESTS_TAG="tags/$LATEST_VERSION" +fi +set -ex + +install_wp() { + + if [ -d $WP_CORE_DIR ]; then + return; + fi + + mkdir -p $WP_CORE_DIR + + if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + mkdir -p $TMPDIR/wordpress-trunk + rm -rf $TMPDIR/wordpress-trunk/* + svn export --quiet https://core.svn.wordpress.org/trunk $TMPDIR/wordpress-trunk/wordpress + mv $TMPDIR/wordpress-trunk/wordpress/* $WP_CORE_DIR + else + if [ $WP_VERSION == 'latest' ]; then + local ARCHIVE_NAME='latest' + elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then + # https serves multiple offers, whereas http serves single. + download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + LATEST_VERSION=${WP_VERSION%??} + else + # otherwise, scan the releases and get the most up to date minor version of the major release + local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` + LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) + fi + if [[ -z "$LATEST_VERSION" ]]; then + local ARCHIVE_NAME="wordpress-$WP_VERSION" + else + local ARCHIVE_NAME="wordpress-$LATEST_VERSION" + fi + else + local ARCHIVE_NAME="wordpress-$WP_VERSION" + fi + download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz + tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR + fi + + download https://raw.githubusercontent.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php +} + +install_test_suite() { + # portable in-place argument for both GNU sed and Mac OSX sed + if [[ $(uname -s) == 'Darwin' ]]; then + local ioption='-i.bak' + else + local ioption='-i' + fi + + # set up testing suite if it doesn't yet exist + if [ ! -d $WP_TESTS_DIR ]; then + # set up testing suite + mkdir -p $WP_TESTS_DIR + rm -rf $WP_TESTS_DIR/{includes,data} + svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes + svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data + fi + + if [ ! -f wp-tests-config.php ]; then + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php + # remove all forward slashes in the end + WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") + sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s:__DIR__ . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + fi + +} + +recreate_db() { + shopt -s nocasematch + if [[ $1 =~ ^(y|yes)$ ]] + then + mysqladmin drop $DB_NAME -f --user="$DB_USER" --password="$DB_PASS"$EXTRA + create_db + echo "Recreated the database ($DB_NAME)." + else + echo "Leaving the existing database ($DB_NAME) in place." + fi + shopt -u nocasematch +} + +create_db() { + mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA +} + +install_db() { + + if [ ${SKIP_DB_CREATE} = "true" ]; then + return 0 + fi + + # parse DB_HOST for port or socket references + local PARTS=(${DB_HOST//\:/ }) + local DB_HOSTNAME=${PARTS[0]}; + local DB_SOCK_OR_PORT=${PARTS[1]}; + local EXTRA="" + + if ! [ -z $DB_HOSTNAME ] ; then + if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then + EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" + elif ! [ -z $DB_SOCK_OR_PORT ] ; then + EXTRA=" --socket=$DB_SOCK_OR_PORT" + elif ! [ -z $DB_HOSTNAME ] ; then + EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" + fi + fi + + # create database + if [ $(mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA --execute='show databases;' | grep ^$DB_NAME$) ] + then + echo "Reinstalling will delete the existing test database ($DB_NAME)" + read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB + recreate_db $DELETE_EXISTING_DB + else + create_db + fi +} + +install_wp +install_test_suite +install_db From 7d3eb408ae7a256396d50d362966fa483edbf3d3 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 5 Jul 2023 23:19:54 +0200 Subject: [PATCH 081/299] Include WP version in GH actions matrix --- .github/workflows/test.yml | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0fd730be9..e4469bc2a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -136,17 +136,38 @@ jobs: strategy: matrix: - php_version: [ '7.3', '7.4', '8.0', '8.1' ] - coverage: [ false ] - - # Run code coverage only on high/low PHP. include: - - php_version: 7.2 + - php_version: "7.2" + wp_version: "6.1" + multisite: true coverage: true - - php_version: 8.2 + + - php_version: "7.3" + wp_version: "trunk" + multisite: true + coverage: false + + - php_version: "7.4" + wp_version: "latest" + multisite: false + coverage: false + + - php_version: "8.0" + wp_version: "6.1" + multisite: false + coverage: false + + - php_version: "8.1" + wp_version: "latest" + multisite: true + coverage: false + + - php_version: "8.2" + wp_version: "6.2" + multisite: true coverage: true - name: "Integration Test: PHP ${{ matrix.php_version }}" + name: "Integration Test: PHP ${{ matrix.php_version }} | WP ${{ matrix.wp_version }}${{ matrix.multisite == true && ' (+ ms)' || '' }}" # Allow builds to fail on as-of-yet unreleased WordPress versions. continue-on-error: ${{ matrix.wp_version == 'trunk' }} From c3f84a741a294cfa2389d4bb9a4307d3f592bb9b Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 5 Jul 2023 23:21:52 +0200 Subject: [PATCH 082/299] Add integration tests config to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 909d53deb..4916eb963 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ composer.lock phpcs.xml .cache/phpcs.cache phpunit.xml +phpunit-integration.xml .phpunit.result.cache ############ From 278c1d2b65cbf949b1785b3be7936d250f11427c Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 5 Jul 2023 23:23:05 +0200 Subject: [PATCH 083/299] Fine-tune the exclusions in CS config --- .phpcs.xml.dist | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index ed678c575..50b4a120f 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -90,8 +90,6 @@ - - @@ -116,6 +114,11 @@ /tests/*/bootstrap\.php$ + + + /tests/integration/bootstrap\.php$ + + /tests/*\.php$ @@ -126,7 +129,7 @@ /tests/* - + /tests/* From 2d56c0a708e667c5744013172af314963fd16675 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 5 Jul 2023 23:24:22 +0200 Subject: [PATCH 084/299] Use a cleaner syntax to travel 2 dirs up --- tests/integration/bootstrap.php | 2 +- tests/unit/bootstrap.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php index 71a9ae55f..f6770f4f2 100644 --- a/tests/integration/bootstrap.php +++ b/tests/integration/bootstrap.php @@ -41,7 +41,7 @@ /* * Load the plugin(s). */ -require_once dirname( dirname( __DIR__ ) ) . '/vendor/yoast/wp-test-utils/src/WPIntegration/bootstrap-functions.php'; +require_once dirname( __DIR__, 2 ) . '/vendor/yoast/wp-test-utils/src/WPIntegration/bootstrap-functions.php'; $GLOBALS['wp_tests_options'] = [ 'active_plugins' => [ diff --git a/tests/unit/bootstrap.php b/tests/unit/bootstrap.php index 5ffcb6446..be2fb093a 100644 --- a/tests/unit/bootstrap.php +++ b/tests/unit/bootstrap.php @@ -12,7 +12,7 @@ define( 'DUPLICATE_POST_FILE', '/var/www/html/wp-content/plugins/duplicate-post/duplicate-post.php' ); define( 'DUPLICATE_POST_CURRENT_VERSION', '4.0' ); -if ( file_exists( dirname( dirname( __DIR__ ) ) . '/vendor/autoload.php' ) === false ) { +if ( file_exists( dirname( __DIR__, 2 ) . '/vendor/autoload.php' ) === false ) { echo PHP_EOL, 'ERROR: Run `composer install` to generate the autoload files before running the unit tests.', PHP_EOL; exit( 1 ); } From e8af90a622aedae1f2cbe6b277e045c9010462ae Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 5 Jul 2023 23:25:07 +0200 Subject: [PATCH 085/299] Remove unnecessary leftovers from Video SEO bootstrap --- tests/integration/bootstrap.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php index f6770f4f2..849438db0 100644 --- a/tests/integration/bootstrap.php +++ b/tests/integration/bootstrap.php @@ -15,25 +15,6 @@ echo 'Welcome to the Duplicate Post Test Suite' . PHP_EOL; echo 'Version: 1.0' . PHP_EOL . PHP_EOL; -/* - * Set up info needed for checking the status of a GitHub issue. - */ -$GLOBALS['github_repo'] = [ - 'name' => 'Yoast Duplicate Post', - 'organisation' => 'Yoast', - 'repo_slug' => 'duplicate-post', - 'api_key' => false, - 'private' => true, -]; - -if ( getenv( 'GITHUB_API_KEY' ) !== false ) { - $GLOBALS['github_repo']['api_key'] = getenv( 'GITHUB_API_KEY' ); -} - -if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) ) { - define( 'WP_TESTS_FORCE_KNOWN_BUGS', ( getenv( 'WP_TESTS_FORCE_KNOWN_BUGS' ) === '1' ) ); -} - if ( ! defined( 'YOAST_DUPLICATE_POST_TEST_ROOT_DIR' ) ) { define( 'YOAST_DUPLICATE_POST_TEST_ROOT_DIR', __DIR__ . '/' ); // Includes trailing slash. } From 0efcb90e420bf86cfdc65bbd0ca61e808daf197d Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 5 Jul 2023 23:26:59 +0200 Subject: [PATCH 086/299] Increase coverage by testing the case where we copy the post date --- tests/integration/post-duplicator-test.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/integration/post-duplicator-test.php b/tests/integration/post-duplicator-test.php index 68681bd71..19e02f581 100644 --- a/tests/integration/post-duplicator-test.php +++ b/tests/integration/post-duplicator-test.php @@ -2,12 +2,6 @@ namespace Yoast\WP\Duplicate_Post\Tests\Integration; -/** - * Yoast Duplicate Post plugin test file. - * - * @package Yoast\WP\Duplicate_Post\Tests - */ - use Yoast\WPTestUtils\WPIntegration\TestCase; use Yoast\WP\Duplicate_Post\Post_Duplicator; @@ -42,12 +36,13 @@ public function set_up() { * @covers ::generate_copy_title * @covers ::generate_copy_status * @covers ::generate_copy_author + * @covers ::set_modified */ public function test_create_duplicate() { $post = $this->factory->post->create_and_get(); - $id = $this->instance->create_duplicate( $post ); + $id = $this->instance->create_duplicate( $post, [ 'copy_date' => true ] ); $this->assertTrue( \is_int( $id ) ); } From 279d68de9fa92ec002f5d9c61f4d943c9b93256d Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 30 Aug 2023 22:40:34 +0200 Subject: [PATCH 087/299] Adapt integration tests for minimum supported WordPress version set to 6.2 --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4469bc2a..bd209af3b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -138,7 +138,7 @@ jobs: matrix: include: - php_version: "7.2" - wp_version: "6.1" + wp_version: "6.2" multisite: true coverage: true @@ -153,7 +153,7 @@ jobs: coverage: false - php_version: "8.0" - wp_version: "6.1" + wp_version: "6.2" multisite: false coverage: false @@ -163,7 +163,7 @@ jobs: coverage: false - php_version: "8.2" - wp_version: "6.2" + wp_version: "6.3" multisite: true coverage: true From d78fd535787dd42916bab60f8b6e0b9bde6e251b Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 28 Sep 2023 10:19:32 +0200 Subject: [PATCH 088/299] Apply suggestions from code review Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com> --- .phpcs.xml.dist | 1 - phpunit-integration.xml.dist | 2 +- tests/integration/bootstrap.php | 4 ++-- tests/integration/post-duplicator-test.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 50b4a120f..9996be2a7 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -89,7 +89,6 @@ - diff --git a/phpunit-integration.xml.dist b/phpunit-integration.xml.dist index 440a3050a..8692218e8 100644 --- a/phpunit-integration.xml.dist +++ b/phpunit-integration.xml.dist @@ -1,7 +1,7 @@ instance->create_duplicate( $post, [ 'copy_date' => true ] ); - $this->assertTrue( \is_int( $id ) ); + $this->assertIsInt( $id ); } } From 0562bf50bf48977f20af81c099d9406717d4e50c Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 28 Sep 2023 13:34:36 +0200 Subject: [PATCH 089/299] Various fixes This commit combines a number of fixes addressing Juliette's feedback, which couldn't be committed separately since they are pretty intertwined: - rename `phpunit-integration.xml.dist` to `phpunit-wp.xml.dist` and adjust references - add `phpunit-wp.xml(.dist)` to `.gitattributes` and `.gitignore` - move from Integration to WP namespace and folder - remove some parts of `bootstrap.php` which are not needed at all, and move `_manually_load_plugin` to a closure --- .gitattributes | 33 ++++++++++--------- .gitignore | 1 + composer.json | 4 +-- ...ntegration.xml.dist => phpunit-wp.xml.dist | 4 +-- tests/{integration => wp}/bootstrap.php | 28 ++++------------ .../post-duplicator-test.php | 2 +- 6 files changed, 29 insertions(+), 43 deletions(-) rename phpunit-integration.xml.dist => phpunit-wp.xml.dist (91%) rename tests/{integration => wp}/bootstrap.php (55%) rename tests/{integration => wp}/post-duplicator-test.php (94%) diff --git a/.gitattributes b/.gitattributes index bbdd753cf..912ac1990 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,22 +5,23 @@ # https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production # https://blog.madewithlove.be/post/gitattributes/ # -/.cache export-ignore -/.github export-ignore -/config export-ignore -/svn-assets export-ignore -/tests export-ignore -.babelrc export-ignore -.editorconfig export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.phpcs.xml.dist export-ignore -CHANGELOG export-ignore -Gruntfile.js export-ignore -LICENSE export-ignore -package.json export-ignore -phpunit.xml.dist export-ignore -README.md export-ignore +/.cache export-ignore +/.github export-ignore +/config export-ignore +/svn-assets export-ignore +/tests export-ignore +.babelrc export-ignore +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.phpcs.xml.dist export-ignore +CHANGELOG export-ignore +Gruntfile.js export-ignore +LICENSE export-ignore +package.json export-ignore +phpunit.xml.dist export-ignore +phpunit-wp.xml.dist export-ignore +README.md export-ignore # # Auto detect text files and perform LF normalization diff --git a/.gitignore b/.gitignore index 4916eb963..0ea5601bf 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ phpcs.xml .cache/phpcs.cache phpunit.xml phpunit-integration.xml +phpunit-wp.xml .phpunit.result.cache ############ diff --git a/composer.json b/composer.json index 5bb9d8310..3bc1623d7 100644 --- a/composer.json +++ b/composer.json @@ -58,10 +58,10 @@ "@php ./vendor/phpunit/phpunit/phpunit" ], "integration-test": [ - "@php ./vendor/phpunit/phpunit/phpunit -c phpunit-integration.xml.dist --no-coverage" + "@php ./vendor/phpunit/phpunit/phpunit -c phpunit-wp.xml.dist --no-coverage" ], "integration-coverage": [ - "@php ./vendor/phpunit/phpunit/phpunit -c phpunit-integration.xml.dist" + "@php ./vendor/phpunit/phpunit/phpunit -c phpunit-wp.xml.dist" ] }, "config": { diff --git a/phpunit-integration.xml.dist b/phpunit-wp.xml.dist similarity index 91% rename from phpunit-integration.xml.dist rename to phpunit-wp.xml.dist index 8692218e8..3c3a0d933 100644 --- a/phpunit-integration.xml.dist +++ b/phpunit-wp.xml.dist @@ -4,7 +4,7 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd" backupGlobals="false" backupStaticAttributes="false" - bootstrap="tests/integration/bootstrap.php" + bootstrap="tests/wp/bootstrap.php" colors="true" convertDeprecationsToExceptions="true" convertErrorsToExceptions="true" @@ -20,7 +20,7 @@ > - ./tests/integration + ./tests/wp diff --git a/tests/integration/bootstrap.php b/tests/wp/bootstrap.php similarity index 55% rename from tests/integration/bootstrap.php rename to tests/wp/bootstrap.php index 0c7b6cb95..de3c4e2b5 100644 --- a/tests/integration/bootstrap.php +++ b/tests/wp/bootstrap.php @@ -15,38 +15,22 @@ echo 'Welcome to the Duplicate Post Test Suite' . PHP_EOL; echo 'Version: 1.0' . PHP_EOL . PHP_EOL; -if ( ! defined( 'YOAST_DUPLICATE_POST_TEST_ROOT_DIR' ) ) { - define( 'YOAST_DUPLICATE_POST_TEST_ROOT_DIR', __DIR__ . '/' ); // Includes trailing slash. -} - /* * Load the plugin(s). */ require_once dirname( __DIR__, 2 ) . '/vendor/yoast/wp-test-utils/src/WPIntegration/bootstrap-functions.php'; -$GLOBALS['wp_tests_options'] = [ - 'active_plugins' => [ - 'duplicate-post/duplicate-post', - ], -]; - $_wp_tests_dir = WPIntegration\get_path_to_wp_test_dir(); -if ( $_wp_tests_dir === false ) { - $_wp_tests_dir = YOAST_DUPLICATE_POST_TEST_ROOT_DIR . '../../../../tests/phpunit/'; -} - // Get access to tests_add_filter() function. require_once $_wp_tests_dir . 'includes/functions.php'; -/** - * Activates this plugin in WordPress so it can be tested. - */ -function _manually_load_plugin() { - require_once YOAST_DUPLICATE_POST_TEST_ROOT_DIR . '../../duplicate-post.php'; -} - -tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); +tests_add_filter( + 'muplugins_loaded', + function() { + require_once dirname( __DIR__, 2 ) . '/duplicate-post.php'; + } +); /* * Load WordPress, which will load the Composer autoload file, and load the MockObject autoloader after that. diff --git a/tests/integration/post-duplicator-test.php b/tests/wp/post-duplicator-test.php similarity index 94% rename from tests/integration/post-duplicator-test.php rename to tests/wp/post-duplicator-test.php index 25efc1c5d..3781b52c1 100644 --- a/tests/integration/post-duplicator-test.php +++ b/tests/wp/post-duplicator-test.php @@ -1,6 +1,6 @@ Date: Thu, 28 Sep 2023 13:35:33 +0200 Subject: [PATCH 090/299] Remove exclusion for the `InvalidFunctionsFileName` sniff after changes to `bootstrap.php` --- .phpcs.xml.dist | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 9996be2a7..8df7102fe 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -113,11 +113,6 @@ /tests/*/bootstrap\.php$ - - - /tests/integration/bootstrap\.php$ - - /tests/*\.php$ From b4455cd7328021b11aa394025c2b9aba674756fe Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 28 Sep 2023 13:37:31 +0200 Subject: [PATCH 091/299] Run integration tests for multisite in GH actions and upload results to Caoveralls Also includes a renaming of the flag for the single site case so the WP version is also included. --- .github/workflows/test.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd209af3b..aa17cd546 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -206,14 +206,26 @@ jobs: shell: bash run: config/scripts/install-wp-tests.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp_version }} - - name: Run integration tests + - name: Run integration tests - single site if: ${{ matrix.coverage == false }} run: composer integration-test - - name: Run integration tests with code coverage + - name: Run integration tests - multisite + if: ${{ matrix.multisite == true && matrix.coverage == false }} + run: composer integration-test + env: + WP_MULTISITE: 1 + + - name: Run integration tests with code coverage - single site if: ${{ matrix.coverage == true }} run: composer integration-coverage + - name: Run integration tests with code coverage - multisite + if: ${{ matrix.multisite == true && matrix.coverage == true }} + run: composer integration-coverage -- --coverage-clover build/logs/clover-integration-ms.xml + env: + WP_MULTISITE: 1 + # PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version. - name: Switch to PHP 7.4 if: ${{ success() && matrix.coverage == true && startsWith( matrix.php_version, '8' ) }} @@ -232,9 +244,17 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} COVERALLS_PARALLEL: true - COVERALLS_FLAG_NAME: intgr-php-${{ matrix.php_version }} + COVERALLS_FLAG_NAME: intgr-php-${{ matrix.php_version }}-wp-${{ matrix.wp_version }} run: php-coveralls -v -x build/logs/clover-integration.xml + - name: Upload coverage results to Coveralls - multisite + if: ${{ success() && matrix.multisite == true && matrix.coverage == true }} + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: intgr-php-${{ matrix.php_version }}-wp-${{ matrix.wp_version }}-ms + run: php-coveralls -v -x build/logs/clover-integration-ms.xml + coveralls-finish: needs: unit runs-on: ubuntu-latest From 011edb90fb0807a51212f8a8212b413e5198c4e0 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 28 Sep 2023 13:39:10 +0200 Subject: [PATCH 092/299] Add `phpunit-wp.xml.dist` to the lists of files that should not trigger CS checks and linting when changed. --- .github/workflows/cs.yml | 2 ++ .github/workflows/lint.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 6738b8b40..e44fdd010 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -19,6 +19,7 @@ on: - 'LICENSE' - 'package.json' - 'phpunit.xml.dist' + - 'phpunit-wp.xml.dist' - 'yarn.lock' - '.github/dependabot.yml' - '.github/workflows/deploy.yml' @@ -42,6 +43,7 @@ on: - 'LICENSE' - 'package.json' - 'phpunit.xml.dist' + - 'phpunit-wp.xml.dist' - 'yarn.lock' - '.github/dependabot.yml' - '.github/workflows/deploy.yml' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cc0795188..0a8c524a3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,6 +25,7 @@ on: - '.phpcs.xml.dist' - 'phpcs.xml.dist' - 'phpunit.xml.dist' + - 'phpunit-wp.xml.dist' - 'yarn.lock' - '.github/dependabot.yml' - '.github/workflows/cs.yml' @@ -50,6 +51,7 @@ on: - '.phpcs.xml.dist' - 'phpcs.xml.dist' - 'phpunit.xml.dist' + - 'phpunit-wp.xml.dist' - 'yarn.lock' - '.github/dependabot.yml' - '.github/workflows/cs.yml' From 41114854f3c7f41b742e7d44cf134b396e137f96 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 28 Sep 2023 14:15:41 +0200 Subject: [PATCH 093/299] Enforce running tests when the `install-wp-tests.sh` script changes --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa17cd546..c43949388 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,6 +30,7 @@ on: - '.github/workflows/deploy.yml' - '.github/workflows/lint.yml' - 'config/**' + - '!config/scripts/install-wp-tests.sh' - 'css/**' - 'js/**' pull_request: @@ -54,6 +55,7 @@ on: - '.github/workflows/deploy.yml' - '.github/workflows/lint.yml' - 'config/**' + - '!config/scripts/install-wp-tests.sh' - 'css/**' - 'js/**' # Allow manually triggering the workflow. From 4c62e9785bd4891ed58a0dc73c0f3ba2996ddac4 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Thu, 28 Sep 2023 15:57:58 +0200 Subject: [PATCH 094/299] Remove exclusion for the `PrefixAllGlobals` sniff after changes to `bootstrap.php` --- .phpcs.xml.dist | 5 ----- tests/wp/bootstrap.php | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 8df7102fe..cde1e5400 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -108,11 +108,6 @@ - - - /tests/*/bootstrap\.php$ - - /tests/*\.php$ diff --git a/tests/wp/bootstrap.php b/tests/wp/bootstrap.php index de3c4e2b5..0bc1ce523 100644 --- a/tests/wp/bootstrap.php +++ b/tests/wp/bootstrap.php @@ -20,10 +20,8 @@ */ require_once dirname( __DIR__, 2 ) . '/vendor/yoast/wp-test-utils/src/WPIntegration/bootstrap-functions.php'; -$_wp_tests_dir = WPIntegration\get_path_to_wp_test_dir(); - // Get access to tests_add_filter() function. -require_once $_wp_tests_dir . 'includes/functions.php'; +require_once WPIntegration\get_path_to_wp_test_dir() . 'includes/functions.php'; tests_add_filter( 'muplugins_loaded', From 04f0da1c53325511a3429364071506aa9073e326 Mon Sep 17 00:00:00 2001 From: Igor <35524806+igorschoester@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:17:20 +0200 Subject: [PATCH 095/299] Add a11y translator comments --- duplicate-post.php | 1 + src/admin/views/options.php | 8 ++++++-- src/ui/row-actions.php | 6 +++--- src/utils.php | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/duplicate-post.php b/duplicate-post.php index a514e4c2d..f777a690d 100644 --- a/duplicate-post.php +++ b/duplicate-post.php @@ -97,6 +97,7 @@ function duplicate_post_plugin_actions( $actions ) { 'settings' => sprintf( '%3$s', menu_page_url( 'duplicatepost', false ), + /* translators: Hidden accessibility text. */ 'aria-label="' . __( 'Settings for Duplicate Post', 'duplicate-post' ) . '"', esc_html__( 'Settings', 'duplicate-post' ) ), diff --git a/src/admin/views/options.php b/src/admin/views/options.php index 9a7b02f11..56f4d7d5a 100644 --- a/src/admin/views/options.php +++ b/src/admin/views/options.php @@ -17,8 +17,12 @@
-
', - \esc_html( $copied_posts ) + \esc_html( $copied_posts ), ); } } diff --git a/src/watchers/copied-post-watcher.php b/src/watchers/copied-post-watcher.php index bd79131a9..2e7278933 100644 --- a/src/watchers/copied-post-watcher.php +++ b/src/watchers/copied-post-watcher.php @@ -49,7 +49,7 @@ public function get_notice_text( $post ) { if ( $this->permissions_helper->has_trashed_rewrite_and_republish_copy( $post ) ) { return \__( 'You can only make one Rewrite & Republish duplicate at a time, and a duplicate of this post already exists in the trash. Permanently delete it if you want to make a new duplicate.', - 'duplicate-post' + 'duplicate-post', ); } @@ -57,7 +57,7 @@ public function get_notice_text( $post ) { if ( ! $scheduled_copy ) { return \__( 'A duplicate of this post was made. Please note that any changes you make to this post will be replaced when the duplicated version is republished.', - 'duplicate-post' + 'duplicate-post', ); } @@ -65,10 +65,10 @@ public function get_notice_text( $post ) { /* translators: %1$s: scheduled date of the copy, %2$s: scheduled time of the copy. */ \__( 'A duplicate of this post was made, which is scheduled to replace this post on %1$s at %2$s.', - 'duplicate-post' + 'duplicate-post', ), \get_the_time( \get_option( 'date_format' ), $scheduled_copy ), - \get_the_time( \get_option( 'time_format' ), $scheduled_copy ) + \get_the_time( \get_option( 'time_format' ), $scheduled_copy ), ); } @@ -118,7 +118,7 @@ public function add_block_editor_notice() { \wp_add_inline_script( 'duplicate_post_edit_script', 'duplicatePostNotices.has_rewrite_and_republish_notice = ' . \wp_json_encode( $notice ) . ';', - 'before' + 'before', ); } } diff --git a/src/watchers/link-actions-watcher.php b/src/watchers/link-actions-watcher.php index 60820ee61..87df47121 100644 --- a/src/watchers/link-actions-watcher.php +++ b/src/watchers/link-actions-watcher.php @@ -74,10 +74,10 @@ public function add_clone_admin_notice() { '%s item copied.', '%s items copied.', $copied_posts, - 'duplicate-post' - ) + 'duplicate-post', + ), ) . '

', - \esc_html( $copied_posts ) + \esc_html( $copied_posts ), ); } } @@ -96,7 +96,7 @@ public function add_rewrite_and_republish_admin_notice() { print '

' . \esc_html__( 'You can now start rewriting your post in this duplicate of the original post. If you click "Republish", your changes will be merged into the original post and you’ll be redirected there.', - 'duplicate-post' + 'duplicate-post', ) . '

'; } } @@ -111,7 +111,7 @@ public function add_rewrite_and_republish_block_editor_notice() { $notice = [ 'text' => \__( 'You can now start rewriting your post in this duplicate of the original post. If you click "Republish", this rewritten post will replace the original post.', - 'duplicate-post' + 'duplicate-post', ), 'status' => 'warning', 'isDismissible' => true, @@ -120,7 +120,7 @@ public function add_rewrite_and_republish_block_editor_notice() { \wp_add_inline_script( 'duplicate_post_edit_script', 'duplicatePostNotices.rewriting_notice = ' . \wp_json_encode( $notice ) . ';', - 'before' + 'before', ); } } diff --git a/src/watchers/original-post-watcher.php b/src/watchers/original-post-watcher.php index d1293923b..93de93b3d 100644 --- a/src/watchers/original-post-watcher.php +++ b/src/watchers/original-post-watcher.php @@ -50,7 +50,7 @@ public function register_hooks() { public function get_notice_text() { return \__( 'The original post has been edited in the meantime. If you click "Republish", this rewritten post will replace the original post.', - 'duplicate-post' + 'duplicate-post', ); } @@ -100,7 +100,7 @@ public function add_block_editor_notice() { \wp_add_inline_script( 'duplicate_post_edit_script', 'duplicatePostNotices.has_original_changed_notice = ' . \wp_json_encode( $notice ) . ';', - 'before' + 'before', ); } } diff --git a/src/watchers/republished-post-watcher.php b/src/watchers/republished-post-watcher.php index 41e0e3230..8b644c631 100644 --- a/src/watchers/republished-post-watcher.php +++ b/src/watchers/republished-post-watcher.php @@ -64,7 +64,7 @@ public function add_removable_query_args( $removable_query_args ) { public function get_notice_text() { return \__( 'Your original post has been replaced with the rewritten post. You are now viewing the (rewritten) original post.', - 'duplicate-post' + 'duplicate-post', ); } @@ -101,7 +101,7 @@ public function add_block_editor_notice() { \wp_add_inline_script( 'duplicate_post_edit_script', 'duplicatePostNotices.republished_notice = ' . \wp_json_encode( $notice ) . ';', - 'before' + 'before', ); } } diff --git a/tests/Unit/Admin/Options_Form_Generator_Test.php b/tests/Unit/Admin/Options_Form_Generator_Test.php index 45ef60260..14348b8aa 100644 --- a/tests/Unit/Admin/Options_Form_Generator_Test.php +++ b/tests/Unit/Admin/Options_Form_Generator_Test.php @@ -70,7 +70,7 @@ protected function set_up() { 'translate_user_role' => static function ( $role ) { return $role; }, - ] + ], ); } @@ -86,7 +86,7 @@ public function test_constructor() { $this->assertInstanceOf( Options_Inputs::class, - $this->getPropertyValue( $this->instance, 'options_inputs' ) + $this->getPropertyValue( $this->instance, 'options_inputs' ), ); } @@ -103,7 +103,7 @@ public function test_generate_options_input_generated_output() { 'checkbox' => '', 'text' => '', 'number' => '', - ] + ], ); Monkey\Functions\expect( '\get_option' )->twice(); @@ -234,7 +234,7 @@ public function test_dont_generate_options_input_for_invalid_version() { $this->assertSame( '
', - $this->instance->generate_options_input( $options ) + $this->instance->generate_options_input( $options ), ); } @@ -265,12 +265,12 @@ public function test_generate_options_input_for_suboptions() { ->andReturnUsing( static function ( $checked, $current = true ) { return ( (string) $checked === (string) $current ) ? " checked='checked'" : ''; - } + }, ); $this->assertSame( '
', - $this->instance->generate_options_input( $options ) + $this->instance->generate_options_input( $options ), ); } @@ -287,8 +287,8 @@ public function test_extract_description() { $this->instance ->extract_description( 'this is a description', - 'textfield-1' - ) + 'textfield-1', + ), ); $this->assertSame( @@ -299,8 +299,8 @@ public function test_extract_description() { 'this is a description', 'this is another description', ], - 'textfield-1' - ) + 'textfield-1', + ), ); } @@ -365,12 +365,12 @@ public function test_generate_taxonomy_exclusion_list() { ->andReturnUsing( static function ( $checked, $current = true ) { return ( (string) $checked === (string) $current ) ? " checked='checked'" : ''; - } + }, ); $this->assertSame( '




', - $this->instance->generate_taxonomy_exclusion_list() + $this->instance->generate_taxonomy_exclusion_list(), ); } @@ -395,7 +395,7 @@ public function test_generate_roles_permission_list() { 'editor' => 'Editor', 'administrator' => 'Administrator', 'subscriber' => 'Subscriber', - ] + ], ); Monkey\Functions\expect( 'checked' ) @@ -403,12 +403,12 @@ public function test_generate_roles_permission_list() { ->andReturnUsing( static function ( $checked, $current = true ) { return ( (string) $checked === (string) $current ) ? " checked='checked'" : ''; - } + }, ); $this->assertSame( '

', - $this->instance->generate_roles_permission_list() + $this->instance->generate_roles_permission_list(), ); } @@ -427,7 +427,7 @@ public function test_generate_post_types_list() { 'attachment', 'wp_block', 'product', - ] + ], ); $this->instance @@ -445,12 +445,12 @@ public function test_generate_post_types_list() { ->andReturnUsing( static function ( $checked, $current = true ) { return ( (string) $checked === (string) $current ) ? " checked='checked'" : ''; - } + }, ); $this->assertSame( '

', - $this->instance->generate_post_types_list() + $this->instance->generate_post_types_list(), ); } diff --git a/tests/Unit/Admin/Options_Inputs_Test.php b/tests/Unit/Admin/Options_Inputs_Test.php index 0c3dbfa6e..5694ad26c 100644 --- a/tests/Unit/Admin/Options_Inputs_Test.php +++ b/tests/Unit/Admin/Options_Inputs_Test.php @@ -45,17 +45,17 @@ public function test_checkbox() { ->andReturnUsing( static function ( $checked, $current = true ) { return ( (string) $checked === (string) $current ) ? " checked='checked'" : ''; - } + }, ); $this->assertSame( '', - $this->instance->checkbox( 'test_checkbox', 1, 'test-checkbox-id', false ) + $this->instance->checkbox( 'test_checkbox', 1, 'test-checkbox-id', false ), ); $this->assertSame( '', - $this->instance->checkbox( 'test_checkbox2', 1, 'test-checkbox-id2', true ) + $this->instance->checkbox( 'test_checkbox2', 1, 'test-checkbox-id2', true ), ); } @@ -69,7 +69,7 @@ static function ( $checked, $current = true ) { public function test_text() { $this->assertSame( '', - $this->instance->text( 'test_text', 'Hello world', 'test-text-id' ) + $this->instance->text( 'test_text', 'Hello world', 'test-text-id' ), ); } @@ -83,7 +83,7 @@ public function test_text() { public function test_number() { $this->assertSame( '', - $this->instance->number( 'test_number', '1', 'test-number-id' ) + $this->instance->number( 'test_number', '1', 'test-number-id' ), ); } } diff --git a/tests/Unit/Admin/Options_Page_Test.php b/tests/Unit/Admin/Options_Page_Test.php index 6111a4afd..e746a2797 100644 --- a/tests/Unit/Admin/Options_Page_Test.php +++ b/tests/Unit/Admin/Options_Page_Test.php @@ -73,12 +73,12 @@ public function test_constructor() { $this->assertInstanceOf( Options::class, - $this->getPropertyValue( $this->instance, 'options' ) + $this->getPropertyValue( $this->instance, 'options' ), ); $this->assertInstanceOf( Options_Form_Generator::class, - $this->getPropertyValue( $this->instance, 'generator' ) + $this->getPropertyValue( $this->instance, 'generator' ), ); } @@ -157,7 +157,7 @@ public function test_register_menu() { 'manage_options', 'duplicatepost', [ $this->instance, 'generate_page' ], - ] + ], ) ->once() ->andReturn( 'duplicatepost_page_hook' ); @@ -209,7 +209,7 @@ public function test_register_capabilities() { [ 'administrator', 'editor', - ] + ], ); $this->instance->register_capabilities(); diff --git a/tests/Unit/Admin/Options_Test.php b/tests/Unit/Admin/Options_Test.php index 106db5d29..ab67cfa41 100644 --- a/tests/Unit/Admin/Options_Test.php +++ b/tests/Unit/Admin/Options_Test.php @@ -103,7 +103,7 @@ public function test_get_options_for_first_tab() { 'value' => 1, ], ], - $options + $options, ); } @@ -127,7 +127,7 @@ public function test_get_options_for_first_tab_and_fieldset() { 'value' => 1, ], ], - $options + $options, ); } @@ -177,7 +177,7 @@ public function test_get_valid_option() { 'value' => 1, ], ], - $options + $options, ); } diff --git a/tests/Unit/Handlers/Check_Changes_Handler_Test.php b/tests/Unit/Handlers/Check_Changes_Handler_Test.php index e194d372b..cac681d26 100644 --- a/tests/Unit/Handlers/Check_Changes_Handler_Test.php +++ b/tests/Unit/Handlers/Check_Changes_Handler_Test.php @@ -54,7 +54,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -149,7 +149,7 @@ public function test_check_changes_action_handler_successful() { - ' + ', ); $this->instance->check_changes_action_handler(); diff --git a/tests/Unit/Handlers/Save_Post_Handler_Test.php b/tests/Unit/Handlers/Save_Post_Handler_Test.php index 1d85ef7a7..c07608778 100644 --- a/tests/Unit/Handlers/Save_Post_Handler_Test.php +++ b/tests/Unit/Handlers/Save_Post_Handler_Test.php @@ -64,7 +64,7 @@ protected function tear_down() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } diff --git a/tests/Unit/Permissions_Helper_Test.php b/tests/Unit/Permissions_Helper_Test.php index c99ce3a46..fd8f9ad97 100644 --- a/tests/Unit/Permissions_Helper_Test.php +++ b/tests/Unit/Permissions_Helper_Test.php @@ -212,7 +212,7 @@ public function test_has_scheduled_rewrite_and_republish_copy_successful() { $this->assertSame( $copy, - $this->instance->has_scheduled_rewrite_and_republish_copy( $post ) + $this->instance->has_scheduled_rewrite_and_republish_copy( $post ), ); } diff --git a/tests/Unit/Post_Duplicator_Test.php b/tests/Unit/Post_Duplicator_Test.php index 8cba2ccbd..d273756e0 100644 --- a/tests/Unit/Post_Duplicator_Test.php +++ b/tests/Unit/Post_Duplicator_Test.php @@ -64,7 +64,7 @@ public function test_get_default_options() { 'taxonomies_excludelist' => [], 'use_filters' => true, ], - $this->instance->get_default_options() + $this->instance->get_default_options(), ); } @@ -175,7 +175,7 @@ public function test_generate_copy_status( $original, $expected ) { ->andReturnUsing( static function ( $post_type ) { return $post_type !== 'post' && $post_type === 'page'; - } + }, ); Monkey\Functions\expect( '\current_user_can' ) @@ -281,7 +281,7 @@ public function test_generate_copy_author( $original, $expected ) { ->andReturnUsing( static function ( $post_type ) { return $post_type !== 'post' && $post_type === 'page'; - } + }, ); Monkey\Functions\expect( '\current_user_can' ) diff --git a/tests/Unit/Post_Republisher_Test.php b/tests/Unit/Post_Republisher_Test.php index 66f2aacbc..35edf8282 100644 --- a/tests/Unit/Post_Republisher_Test.php +++ b/tests/Unit/Post_Republisher_Test.php @@ -48,7 +48,7 @@ protected function set_up() { $this->instance = Mockery::mock( Post_Republisher::class, - [ $this->post_duplicator, $this->permissions_helper ] + [ $this->post_duplicator, $this->permissions_helper ], )->makePartial(); } @@ -73,12 +73,12 @@ protected function tear_down() { public function test_constructor() { $this->assertInstanceOf( Post_Duplicator::class, - $this->getPropertyValue( $this->instance, 'post_duplicator' ) + $this->getPropertyValue( $this->instance, 'post_duplicator' ), ); $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -380,7 +380,7 @@ public function test_clean_up_orphaned_copy_deletes_orphaned_copy() { 'wp_unslash' => static function ( $value ) { return $value; }, - ] + ], ); Monkey\Functions\expect( 'get_post' ) @@ -432,7 +432,7 @@ public function test_clean_up_orphaned_copy_does_not_delete_non_orphaned_copy() 'wp_unslash' => static function ( $value ) { return $value; }, - ] + ], ); Monkey\Functions\expect( 'get_post' ) @@ -479,7 +479,7 @@ public function test_clean_up_orphaned_copy_returns_early_when_no_copy() { 'wp_unslash' => static function ( $value ) { return $value; }, - ] + ], ); Monkey\Functions\expect( 'get_post' ) diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index 6f0ac3d33..b955d8bcc 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -32,7 +32,7 @@ protected function stub_wp_roles() { 'has_cap' => true, 'add_cap' => null, 'remove_cap' => null, - ] + ], ); $role2 = Mockery::mock( WP_Role::class ); @@ -47,7 +47,7 @@ protected function stub_wp_roles() { 'has_cap' => false, 'add_cap' => null, 'remove_cap' => null, - ] + ], ); $role3 = Mockery::mock( WP_Role::class ); @@ -58,7 +58,7 @@ protected function stub_wp_roles() { 'has_cap' => false, 'add_cap' => null, 'remove_cap' => null, - ] + ], ); $role_objects = [ @@ -72,7 +72,7 @@ protected function stub_wp_roles() { 'get_role' => static function ( $name ) use ( $role_objects ) { return $role_objects[ $name ]; }, - ] + ], ); } } diff --git a/tests/Unit/UI/Admin_Bar_Test.php b/tests/Unit/UI/Admin_Bar_Test.php index fb3d09d47..6bc61d06a 100644 --- a/tests/Unit/UI/Admin_Bar_Test.php +++ b/tests/Unit/UI/Admin_Bar_Test.php @@ -65,7 +65,7 @@ protected function set_up() { $this->link_builder, $this->permissions_helper, $this->asset_manager, - ] + ], )->makePartial(); } @@ -79,17 +79,17 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Link_Builder::class, - $this->getPropertyValue( $this->instance, 'link_builder' ) + $this->getPropertyValue( $this->instance, 'link_builder' ), ); $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); $this->assertInstanceOf( Asset_Manager::class, - $this->getPropertyValue( $this->instance, 'asset_manager' ) + $this->getPropertyValue( $this->instance, 'asset_manager' ), ); } diff --git a/tests/Unit/UI/Asset_Manager_Test.php b/tests/Unit/UI/Asset_Manager_Test.php index 8efbbaa8a..9bc108d54 100644 --- a/tests/Unit/UI/Asset_Manager_Test.php +++ b/tests/Unit/UI/Asset_Manager_Test.php @@ -64,7 +64,7 @@ public function test_register_styles() { 'duplicate-post', $styles_url, [], - \DUPLICATE_POST_CURRENT_VERSION + \DUPLICATE_POST_CURRENT_VERSION, ); Monkey\Functions\expect( '\wp_register_style' ) @@ -72,7 +72,7 @@ public function test_register_styles() { 'duplicate-post-options', $options_styles_url, [], - \DUPLICATE_POST_CURRENT_VERSION + \DUPLICATE_POST_CURRENT_VERSION, ); $this->instance->register_styles(); @@ -113,12 +113,12 @@ public function test_register_scripts() { 'wp-i18n', ], \DUPLICATE_POST_CURRENT_VERSION, - true + true, ); Monkey\Functions\expect( '\wp_set_script_translations' ) ->with( 'duplicate_post_edit_script', - 'duplicate-post' + 'duplicate-post', ); Monkey\Functions\expect( '\wp_register_script' ) @@ -131,12 +131,12 @@ public function test_register_scripts() { 'wp-i18n', ], \DUPLICATE_POST_CURRENT_VERSION, - true + true, ); Monkey\Functions\expect( '\wp_set_script_translations' ) ->with( 'duplicate_post_strings', - 'duplicate-post' + 'duplicate-post', ); Monkey\Functions\expect( '\wp_register_script' ) @@ -145,7 +145,7 @@ public function test_register_scripts() { $quick_edit_script_url, [ 'jquery' ], \DUPLICATE_POST_CURRENT_VERSION, - true + true, ); Monkey\Functions\expect( '\wp_register_script' ) @@ -154,7 +154,7 @@ public function test_register_scripts() { $options_script_url, [ 'jquery' ], \DUPLICATE_POST_CURRENT_VERSION, - true + true, ); $this->instance->register_scripts(); diff --git a/tests/Unit/UI/Block_Editor_Test.php b/tests/Unit/UI/Block_Editor_Test.php index dc16f17b4..8b1b652cb 100644 --- a/tests/Unit/UI/Block_Editor_Test.php +++ b/tests/Unit/UI/Block_Editor_Test.php @@ -62,7 +62,7 @@ protected function set_up() { $this->link_builder, $this->permissions_helper, $this->asset_manager, - ] + ], )->makePartial(); } @@ -76,12 +76,12 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Link_Builder::class, - $this->getPropertyValue( $this->instance, 'link_builder' ) + $this->getPropertyValue( $this->instance, 'link_builder' ), ); $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -101,9 +101,9 @@ public function test_register_hooks() { [ $this->instance, 'hide_elementor_post_status', - ] + ], ), - 'Does not have expected elementor/editor/after_enqueue_styles action' + 'Does not have expected elementor/editor/after_enqueue_styles action', ); $this->assertNotFalse( @@ -112,9 +112,9 @@ public function test_register_hooks() { [ $this->instance, 'enqueue_elementor_script', - ] + ], ), - 'Does not have expected elementor/editor/before_enqueue_scripts action' + 'Does not have expected elementor/editor/before_enqueue_scripts action', ); $this->assertNotFalse( @@ -123,9 +123,9 @@ public function test_register_hooks() { [ $this->instance, 'should_previously_used_keyword_assessment_run', - ] + ], ), - 'Does not have expected admin_enqueue_scripts action' + 'Does not have expected admin_enqueue_scripts action', ); $this->assertNotFalse( @@ -134,9 +134,9 @@ public function test_register_hooks() { [ $this->instance, 'enqueue_block_editor_scripts', - ] + ], ), - 'Does not have expected enqueue_block_editor_assets action' + 'Does not have expected enqueue_block_editor_assets action', ); $this->assertNotFalse( @@ -145,9 +145,9 @@ public function test_register_hooks() { [ $this->instance, 'remove_original_from_wpseo_link_suggestions', - ] + ], ), - 'Does not have expected wpseo_link_suggestions_indexables filter' + 'Does not have expected wpseo_link_suggestions_indexables filter', ); } @@ -803,7 +803,7 @@ public function test_get_original_post_edit_url_successful() { ->andReturnUsing( static function ( $query_string ) { return 'http://basic.wordpress.test/wp-admin/' . $query_string; - } + }, ); Monkey\Functions\expect( '\wp_create_nonce' ) @@ -818,12 +818,12 @@ static function ( $arguments, $query_string ) { } return $query_string; - } + }, ); $this->assertSame( 'http://basic.wordpress.test/wp-admin/post.php?action=edit&post=64&dprepublished=1&dpcopy=128&dpnonce=12345678', - $this->instance->get_original_post_edit_url() + $this->instance->get_original_post_edit_url(), ); } @@ -850,7 +850,7 @@ public function test_get_original_post_edit_url_not_rewrite_and_republish() { $this->assertSame( '', - $this->instance->get_original_post_edit_url() + $this->instance->get_original_post_edit_url(), ); } @@ -867,7 +867,7 @@ public function test_get_original_post_edit_url_no_post() { $this->assertSame( '', - $this->instance->get_original_post_edit_url() + $this->instance->get_original_post_edit_url(), ); } @@ -901,7 +901,7 @@ public function test_get_original_post_edit_url_no_original() { $this->assertSame( '', - $this->instance->get_original_post_edit_url() + $this->instance->get_original_post_edit_url(), ); } @@ -927,7 +927,7 @@ public function test_hide_elementor_post_status() { Monkey\Functions\expect( '\wp_add_inline_style' ) ->with( 'elementor-editor', - '.elementor-control-post_status { display: none !important; }' + '.elementor-control-post_status { display: none !important; }', ); $this->instance->hide_elementor_post_status(); diff --git a/tests/Unit/UI/Bulk_Actions_Test.php b/tests/Unit/UI/Bulk_Actions_Test.php index 7ac5bc340..6c7d7ae81 100644 --- a/tests/Unit/UI/Bulk_Actions_Test.php +++ b/tests/Unit/UI/Bulk_Actions_Test.php @@ -49,7 +49,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -182,7 +182,7 @@ public function test_register_bulk_action() { 'duplicate_post_bulk_clone' => 'Clone', 'duplicate_post_bulk_rewrite_republish' => 'Rewrite & Republish', ], - $this->instance->register_bulk_action( $array ) + $this->instance->register_bulk_action( $array ), ); } } diff --git a/tests/Unit/UI/Classic_Editor_Test.php b/tests/Unit/UI/Classic_Editor_Test.php index 13aedfea6..5e269e171 100644 --- a/tests/Unit/UI/Classic_Editor_Test.php +++ b/tests/Unit/UI/Classic_Editor_Test.php @@ -62,7 +62,7 @@ protected function set_up() { $this->link_builder, $this->permissions_helper, $this->asset_manager, - ] + ], )->makePartial(); } @@ -76,12 +76,12 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Link_Builder::class, - $this->getPropertyValue( $this->instance, 'link_builder' ) + $this->getPropertyValue( $this->instance, 'link_builder' ), ); $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -239,7 +239,7 @@ public function test_add_new_draft_post_button_successful() { ->andReturn( $url ); $this->expectOutputRegex( - '`\s*`' + '`\s*`', ); $this->instance->add_new_draft_post_button( $post ); @@ -280,7 +280,7 @@ public function test_add_new_draft_post_button_successful_post_from_GET() { ->andReturn( $url ); $this->expectOutputRegex( - '`\s*`' + '`\s*`', ); $this->instance->add_new_draft_post_button(); @@ -387,7 +387,7 @@ public function test_add_rewrite_and_republish_post_button_successful() { ->andReturn( $url ); $this->expectOutputRegex( - '`\s*`' + '`\s*`', ); $this->instance->add_rewrite_and_republish_post_button( $post ); @@ -434,7 +434,7 @@ public function test_add_rewrite_and_republish_post_button_post_from_GET() { ->andReturn( $url ); $this->expectOutputRegex( - '`\s*`' + '`\s*`', ); $this->instance->add_rewrite_and_republish_post_button(); diff --git a/tests/Unit/UI/Column_Test.php b/tests/Unit/UI/Column_Test.php index eddf59e62..e8c94af64 100644 --- a/tests/Unit/UI/Column_Test.php +++ b/tests/Unit/UI/Column_Test.php @@ -59,12 +59,12 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); $this->assertInstanceOf( Asset_Manager::class, - $this->getPropertyValue( $this->instance, 'asset_manager' ) + $this->getPropertyValue( $this->instance, 'asset_manager' ), ); } @@ -129,7 +129,7 @@ public function test_add_original_column_action() { 'date' => 'Date', 'duplicate_post_original_item' => 'Original item', ], - $this->instance->add_original_column( $array ) + $this->instance->add_original_column( $array ), ); } } diff --git a/tests/Unit/UI/Link_Builder_Test.php b/tests/Unit/UI/Link_Builder_Test.php index 1cab4eeab..aa8c70901 100644 --- a/tests/Unit/UI/Link_Builder_Test.php +++ b/tests/Unit/UI/Link_Builder_Test.php @@ -50,7 +50,7 @@ public function test_build_rewrite_and_republish_link() { $this->assertSame( $url, - $this->instance->build_rewrite_and_republish_link( $post, $context ) + $this->instance->build_rewrite_and_republish_link( $post, $context ), ); } @@ -73,7 +73,7 @@ public function test_build_clone_link() { $this->assertSame( $url, - $this->instance->build_clone_link( $post, $context ) + $this->instance->build_clone_link( $post, $context ), ); } @@ -96,7 +96,7 @@ public function test_build_new_draft_link() { $this->assertSame( $url, - $this->instance->build_new_draft_link( $post, $context ) + $this->instance->build_new_draft_link( $post, $context ), ); } @@ -119,7 +119,7 @@ public function test_build_check_link() { $this->assertSame( $url, - $this->instance->build_check_link( $post, $context ) + $this->instance->build_check_link( $post, $context ), ); } @@ -143,7 +143,7 @@ public function test_build_link() { ->andReturnUsing( static function ( $query_string ) { return 'http://basic.wordpress.test/wp-admin/' . $query_string; - } + }, ); Monkey\Functions\expect( '\wp_nonce_url' ) @@ -151,7 +151,7 @@ static function ( $query_string ) { $this->assertSame( 'http://basic.wordpress.test/wp-admin/admin.php?action=duplicate_post_clone&post=123', - $this->instance->build_link( $post, $context, $action_name ) + $this->instance->build_link( $post, $context, $action_name ), ); $this->assertTrue( Monkey\Filters\applied( 'duplicate_post_get_clone_post_link' ) > 0 ); } @@ -176,7 +176,7 @@ public function test_build_link_not_display() { ->andReturnUsing( static function ( $query_string ) { return 'http://basic.wordpress.test/wp-admin/' . $query_string; - } + }, ); Monkey\Functions\expect( '\wp_nonce_url' ) @@ -184,7 +184,7 @@ static function ( $query_string ) { $this->assertSame( 'http://basic.wordpress.test/wp-admin/admin.php?action=duplicate_post_clone&post=123', - $this->instance->build_link( $post, $context, $action_name ) + $this->instance->build_link( $post, $context, $action_name ), ); $this->assertTrue( Monkey\Filters\applied( 'duplicate_post_get_clone_post_link' ) > 0 ); } @@ -212,7 +212,7 @@ public function test_build_link_no_post() { $this->assertSame( '', - $this->instance->build_link( $post, $context, $action_name ) + $this->instance->build_link( $post, $context, $action_name ), ); $this->assertTrue( Monkey\Filters\applied( 'duplicate_post_get_clone_post_link' ) === 0 ); } diff --git a/tests/Unit/UI/Metabox_Test.php b/tests/Unit/UI/Metabox_Test.php index 40ac17c42..349c555fc 100644 --- a/tests/Unit/UI/Metabox_Test.php +++ b/tests/Unit/UI/Metabox_Test.php @@ -54,7 +54,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -111,7 +111,7 @@ public function test_add_custom_metabox() { 'post', 'side', 'default', - [ 'original' => $original_item ] + [ 'original' => $original_item ], ); $this->instance->add_custom_metabox( 'post', $post ); diff --git a/tests/Unit/UI/Post_States_Test.php b/tests/Unit/UI/Post_States_Test.php index 09d4d67fb..e89a67985 100644 --- a/tests/Unit/UI/Post_States_Test.php +++ b/tests/Unit/UI/Post_States_Test.php @@ -51,7 +51,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -109,7 +109,7 @@ public function test_show_original_in_post_states_successful() { 'draft' => 'Draft', 'duplicate_post_original_item' => 'Original: Original post', ], - $this->instance->show_original_in_post_states( $post_states, $post ) + $this->instance->show_original_in_post_states( $post_states, $post ), ); } @@ -148,7 +148,7 @@ public function test_show_original_in_post_states_unsuccessful() { [ 'draft' => 'Draft', ], - $this->instance->show_original_in_post_states( $post_states, $post ) + $this->instance->show_original_in_post_states( $post_states, $post ), ); } @@ -193,7 +193,7 @@ public function test_show_original_in_rewrite_republish_post_successful() { 'draft' => 'Draft', 'duplicate_post_original_item' => 'Rewrite & Republish of Original post', ], - $this->instance->show_original_in_post_states( $post_states, $post ) + $this->instance->show_original_in_post_states( $post_states, $post ), ); } @@ -232,7 +232,7 @@ public function test_show_original_in_rewrite_republish_post_unsuccessful() { [ 'draft' => 'Draft', ], - $this->instance->show_original_in_post_states( $post_states, $post ) + $this->instance->show_original_in_post_states( $post_states, $post ), ); } } diff --git a/tests/Unit/UI/Row_Actions_Test.php b/tests/Unit/UI/Row_Actions_Test.php index 2ed1d03c2..e7c753bfb 100644 --- a/tests/Unit/UI/Row_Actions_Test.php +++ b/tests/Unit/UI/Row_Actions_Test.php @@ -61,12 +61,12 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Link_Builder::class, - $this->getPropertyValue( $this->instance, 'link_builder' ) + $this->getPropertyValue( $this->instance, 'link_builder' ), ); $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -145,7 +145,7 @@ public function test_add_clone_action_link_successful() { ->andReturnUsing( static function ( $post ) { return $post->post_title; - } + }, ); $this->link_builder @@ -161,7 +161,7 @@ static function ( $post ) { 'view' => 'Preview', 'clone' => 'Clone', ], - $this->instance->add_clone_action_link( $actions, $post ) + $this->instance->add_clone_action_link( $actions, $post ), ); } @@ -200,7 +200,7 @@ public function test_add_clone_action_link_unsuccessful() { 'trash' => 'Trash', 'view' => 'Preview', ], - $this->instance->add_clone_action_link( $actions, $post ) + $this->instance->add_clone_action_link( $actions, $post ), ); } @@ -237,7 +237,7 @@ public function test_add_new_draft_action_link_successful() { ->andReturnUsing( static function ( $post ) { return $post->post_title; - } + }, ); $this->link_builder @@ -253,7 +253,7 @@ static function ( $post ) { 'view' => 'Preview', 'edit_as_new_draft' => 'New Draft', ], - $this->instance->add_new_draft_action_link( $actions, $post ) + $this->instance->add_new_draft_action_link( $actions, $post ), ); } @@ -292,7 +292,7 @@ public function test_add_new_draft_action_link_unsuccessful() { 'trash' => 'Trash', 'view' => 'Preview', ], - $this->instance->add_new_draft_action_link( $actions, $post ) + $this->instance->add_new_draft_action_link( $actions, $post ), ); } @@ -335,7 +335,7 @@ public function test_add_rewrite_and_republish_action_link_successful() { ->andReturnUsing( static function ( $post ) { return $post->post_title; - } + }, ); $this->link_builder @@ -351,7 +351,7 @@ static function ( $post ) { 'view' => 'Preview', 'rewrite' => 'Rewrite & Republish', ], - $this->instance->add_rewrite_and_republish_action_link( $actions, $post ) + $this->instance->add_rewrite_and_republish_action_link( $actions, $post ), ); } @@ -396,7 +396,7 @@ public function test_add_rewrite_and_republish_action_link_unsuccessful_should_n 'trash' => 'Trash', 'view' => 'Preview', ], - $this->instance->add_rewrite_and_republish_action_link( $actions, $post ) + $this->instance->add_rewrite_and_republish_action_link( $actions, $post ), ); } @@ -440,7 +440,7 @@ public function test_add_rewrite_and_republish_action_link_unsuccessful_not_publ 'trash' => 'Trash', 'view' => 'Preview', ], - $this->instance->add_rewrite_and_republish_action_link( $actions, $post ) + $this->instance->add_rewrite_and_republish_action_link( $actions, $post ), ); $this->assertTrue( Monkey\Filters\applied( 'duplicate_post_show_link' ) === 0 ); } diff --git a/tests/Unit/Watchers/Bulk_Actions_Watcher_Test.php b/tests/Unit/Watchers/Bulk_Actions_Watcher_Test.php index 7ffd6c3b2..ce41258f8 100644 --- a/tests/Unit/Watchers/Bulk_Actions_Watcher_Test.php +++ b/tests/Unit/Watchers/Bulk_Actions_Watcher_Test.php @@ -124,7 +124,7 @@ public function test_add_removable_query_args() { 'bulk_cloned', 'bulk_rewriting', ], - $this->instance->add_removable_query_args( $array ) + $this->instance->add_removable_query_args( $array ), ); } diff --git a/tests/Unit/Watchers/Copied_Post_Watcher_Test.php b/tests/Unit/Watchers/Copied_Post_Watcher_Test.php index 273ee3ecf..88d34138f 100644 --- a/tests/Unit/Watchers/Copied_Post_Watcher_Test.php +++ b/tests/Unit/Watchers/Copied_Post_Watcher_Test.php @@ -39,7 +39,7 @@ protected function set_up() { $this->permissions_helper = Mockery::mock( Permissions_Helper::class ); $this->instance = Mockery::mock( - Copied_Post_Watcher::class + Copied_Post_Watcher::class, )->makePartial(); $this->instance->__construct( $this->permissions_helper ); } @@ -54,7 +54,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -96,7 +96,7 @@ public function test_get_notice_text_not_scheduled() { $this->assertSame( 'A duplicate of this post was made. Please note that any changes you make to this post will be replaced when the duplicated version is republished.', - $this->instance->get_notice_text( $post ) + $this->instance->get_notice_text( $post ), ); } @@ -133,7 +133,7 @@ public function test_get_notice_text_scheduled() { $this->assertSame( 'A duplicate of this post was made, which is scheduled to replace this post on 2020/12/02 at 10:30 am.', - $this->instance->get_notice_text( $post ) + $this->instance->get_notice_text( $post ), ); } @@ -160,7 +160,7 @@ public function test_get_notice_text_copy_in_the_trash() { $this->assertSame( 'You can only make one Rewrite & Republish duplicate at a time, and a duplicate of this post already exists in the trash. Permanently delete it if you want to make a new duplicate.', - $this->instance->get_notice_text( $post ) + $this->instance->get_notice_text( $post ), ); } @@ -278,7 +278,7 @@ public function test_add_block_editor_notice() { ->with( 'duplicate_post_edit_script', 'duplicatePostNotices.has_rewrite_and_republish_notice = {"text":"notice","status":"warning","isDismissible":true};', - 'before' + 'before', ); $this->instance->add_block_editor_notice(); diff --git a/tests/Unit/Watchers/Link_Actions_Watcher_Test.php b/tests/Unit/Watchers/Link_Actions_Watcher_Test.php index bffcdae76..ae87193a3 100644 --- a/tests/Unit/Watchers/Link_Actions_Watcher_Test.php +++ b/tests/Unit/Watchers/Link_Actions_Watcher_Test.php @@ -38,7 +38,7 @@ protected function set_up() { $this->permissions_helper = Mockery::mock( Permissions_Helper::class ); $this->instance = Mockery::mock( - Link_Actions_Watcher::class + Link_Actions_Watcher::class, )->makePartial(); $this->instance->__construct( $this->permissions_helper ); } @@ -53,7 +53,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -141,7 +141,7 @@ public function test_add_removable_query_args() { 'cloned', 'rewriting', ], - $this->instance->add_removable_query_args( $array ) + $this->instance->add_removable_query_args( $array ), ); } @@ -264,7 +264,7 @@ public function test_add_rewrite_and_republish_block_editor_notice() { ->with( 'duplicate_post_edit_script', 'duplicatePostNotices.rewriting_notice = {"text":"You can now start rewriting your post in this duplicate of the original post. If you click \"Republish\", this rewritten post will replace the original post.","status":"warning","isDismissible":true};', - 'before' + 'before', ); $this->instance->add_rewrite_and_republish_block_editor_notice(); diff --git a/tests/Unit/Watchers/Original_Post_Watcher_Test.php b/tests/Unit/Watchers/Original_Post_Watcher_Test.php index a5a3236ca..f23543929 100644 --- a/tests/Unit/Watchers/Original_Post_Watcher_Test.php +++ b/tests/Unit/Watchers/Original_Post_Watcher_Test.php @@ -39,7 +39,7 @@ protected function set_up() { $this->permissions_helper = Mockery::mock( Permissions_Helper::class ); $this->instance = Mockery::mock( - Original_Post_Watcher::class + Original_Post_Watcher::class, )->makePartial(); $this->instance->__construct( $this->permissions_helper ); } @@ -54,7 +54,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -84,7 +84,7 @@ public function test_get_notice_text() { $this->assertSame( 'The original post has been edited in the meantime. If you click "Republish", this rewritten post will replace the original post.', - $this->instance->get_notice_text() + $this->instance->get_notice_text(), ); } @@ -201,7 +201,7 @@ public function test_add_block_editor_notice() { ->with( 'duplicate_post_edit_script', 'duplicatePostNotices.has_original_changed_notice = {"text":"notice","status":"warning","isDismissible":true};', - 'before' + 'before', ); $this->instance->add_block_editor_notice(); diff --git a/tests/Unit/Watchers/Republished_Post_Watcher_Test.php b/tests/Unit/Watchers/Republished_Post_Watcher_Test.php index 998de62b2..08d3517e5 100644 --- a/tests/Unit/Watchers/Republished_Post_Watcher_Test.php +++ b/tests/Unit/Watchers/Republished_Post_Watcher_Test.php @@ -38,7 +38,7 @@ protected function set_up() { $this->permissions_helper = Mockery::mock( Permissions_Helper::class ); $this->instance = Mockery::mock( - Republished_Post_Watcher::class + Republished_Post_Watcher::class, )->makePartial(); $this->instance->__construct( $this->permissions_helper ); } @@ -53,7 +53,7 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); $this->instance->expects( 'register_hooks' )->once(); @@ -87,7 +87,7 @@ public function test_get_notice_text() { $this->assertSame( 'Your original post has been replaced with the rewritten post. You are now viewing the (rewritten) original post.', - $this->instance->get_notice_text() + $this->instance->get_notice_text(), ); } @@ -162,7 +162,7 @@ public function test_add_block_editor_notice() { ->with( 'duplicate_post_edit_script', 'duplicatePostNotices.republished_notice = {"text":"notice","status":"success","isDismissible":true};', - 'before' + 'before', ); $_REQUEST['dprepublished'] = '1'; @@ -242,7 +242,7 @@ public function test_add_removable_query_args() { 'dpcopy', 'dpnonce', ], - $this->instance->add_removable_query_args( $array ) + $this->instance->add_removable_query_args( $array ), ); } } diff --git a/tests/WP/Admin_Functions_Test.php b/tests/WP/Admin_Functions_Test.php index dddf89dbd..0710454c5 100644 --- a/tests/WP/Admin_Functions_Test.php +++ b/tests/WP/Admin_Functions_Test.php @@ -792,7 +792,7 @@ public function test_create_duplicate_copies_children_when_enabled() { 'post_type' => 'page', 'post_title' => 'Parent Page', 'post_status' => 'publish', - ] + ], ); $this->factory->post->create_and_get( @@ -801,7 +801,7 @@ public function test_create_duplicate_copies_children_when_enabled() { 'post_title' => 'Child Page', 'post_parent' => $parent->ID, 'post_status' => 'publish', - ] + ], ); $new_parent_id = \duplicate_post_create_duplicate( $parent ); @@ -814,7 +814,7 @@ public function test_create_duplicate_copies_children_when_enabled() { [ 'post_parent' => $new_parent_id, 'post_type' => 'page', - ] + ], ); $this->assertCount( 1, $new_children ); @@ -837,7 +837,7 @@ public function test_create_duplicate_does_not_copy_children_when_disabled() { 'post_type' => 'page', 'post_title' => 'Parent Page', 'post_status' => 'publish', - ] + ], ); $this->factory->post->create_and_get( @@ -846,7 +846,7 @@ public function test_create_duplicate_does_not_copy_children_when_disabled() { 'post_title' => 'Child Page', 'post_parent' => $parent->ID, 'post_status' => 'publish', - ] + ], ); $new_parent_id = \duplicate_post_create_duplicate( $parent ); @@ -856,7 +856,7 @@ public function test_create_duplicate_does_not_copy_children_when_disabled() { [ 'post_parent' => $new_parent_id, 'post_type' => 'page', - ] + ], ); $this->assertCount( 0, $new_children ); @@ -883,7 +883,7 @@ public function test_create_duplicate_copies_comments_when_enabled() { [ 'comment_post_ID' => $original->ID, 'comment_content' => 'Test comment content', - ] + ], ); $new_id = \duplicate_post_create_duplicate( $original ); @@ -913,7 +913,7 @@ public function test_create_duplicate_does_not_copy_comments_when_disabled() { [ 'comment_post_ID' => $original->ID, 'comment_content' => 'Test comment content', - ] + ], ); $new_id = \duplicate_post_create_duplicate( $original ); @@ -1026,7 +1026,7 @@ public function test_create_duplicate_fires_after_duplicated_action_for_page() { 'post_title' => 'Original Page for Hook Test', 'post_content' => 'Page content for testing hook.', 'post_status' => 'publish', - ] + ], ); $new_id = \duplicate_post_create_duplicate( $original, 'draft' ); @@ -1054,7 +1054,7 @@ public function test_create_duplicate_fires_after_duplicated_action_for_custom_p 'public' => true, 'label' => 'Test CPT', 'supports' => [ 'title', 'editor', 'excerpt' ], - ] + ], ); // Enable the custom post type for duplication. @@ -1078,7 +1078,7 @@ public function test_create_duplicate_fires_after_duplicated_action_for_custom_p 'post_title' => 'Original Custom Post Type', 'post_content' => 'Custom post type content for testing hook.', 'post_status' => 'publish', - ] + ], ); $new_id = \duplicate_post_create_duplicate( $original, 'pending' ); @@ -1108,7 +1108,7 @@ public function test_create_duplicate_works_with_pages() { 'post_title' => 'Original Page', 'post_content' => 'Page content.', 'post_status' => 'publish', - ] + ], ); $new_id = \duplicate_post_create_duplicate( $original ); @@ -1214,7 +1214,7 @@ public function test_create_duplicate_does_not_copy_thumbnail_when_disabled() { 'post_mime_type' => 'image/png', 'post_type' => 'attachment', 'post_title' => 'Test Image', - ] + ], ); // Set thumbnail via meta (more reliable in tests than set_post_thumbnail). @@ -1248,7 +1248,7 @@ public function test_create_duplicate_copies_thumbnail_when_enabled() { 'post_mime_type' => 'image/png', 'post_type' => 'attachment', 'post_title' => 'Test Image', - ] + ], ); // Set thumbnail via meta (more reliable in tests than set_post_thumbnail). diff --git a/tests/WP/Post_Republisher_Test.php b/tests/WP/Post_Republisher_Test.php index d3dd977ae..db74d055b 100644 --- a/tests/WP/Post_Republisher_Test.php +++ b/tests/WP/Post_Republisher_Test.php @@ -172,7 +172,7 @@ public function test_create_duplicate_for_rewrite_and_republish_copies_content() 'post_title' => 'Test Title', 'post_content' => 'Test content here.', 'post_excerpt' => 'Test excerpt.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -231,7 +231,7 @@ public function test_republish_overwrites_original_content() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $original_slug = $original->post_name; @@ -246,7 +246,7 @@ public function test_republish_overwrites_original_content() { 'post_title' => 'Updated Title', 'post_content' => 'Updated content.', 'post_excerpt' => 'Updated excerpt.', - ] + ], ); // Refresh the copy object. @@ -393,7 +393,7 @@ public function test_republish_scheduled_post_republishes_copy() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $original_id = $original->ID; @@ -406,7 +406,7 @@ public function test_republish_scheduled_post_republishes_copy() { 'ID' => $copy->ID, 'post_title' => 'Scheduled Updated Title', 'post_content' => 'Scheduled updated content.', - ] + ], ); // Refresh the copy. @@ -516,7 +516,7 @@ public function test_republish_works_when_status_is_dp_rewrite_republish() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -527,7 +527,7 @@ public function test_republish_works_when_status_is_dp_rewrite_republish() { 'post_title' => 'Republished Title', 'post_content' => 'Republished content.', 'post_status' => 'dp-rewrite-republish', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -557,7 +557,7 @@ public function test_republish_works_when_status_is_private() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -568,7 +568,7 @@ public function test_republish_works_when_status_is_private() { 'post_title' => 'Private Copy Title', 'post_content' => 'Private copy content.', 'post_status' => 'private', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -596,7 +596,7 @@ public function test_republish_request_does_not_republish_draft_copy() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -605,7 +605,7 @@ public function test_republish_request_does_not_republish_draft_copy() { [ 'ID' => $copy->ID, 'post_title' => 'Draft Copy Title', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -629,7 +629,7 @@ public function test_republish_request_does_not_republish_pending_copy() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -639,7 +639,7 @@ public function test_republish_request_does_not_republish_pending_copy() { 'ID' => $copy->ID, 'post_title' => 'Pending Copy Title', 'post_status' => 'pending', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -674,7 +674,7 @@ public function test_republish_handles_post_without_taxonomies() { 'ID' => $copy->ID, 'post_title' => 'Updated Title Without Taxonomies', 'post_content' => 'Updated content.', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -706,7 +706,7 @@ public function test_duplicator_creates_copy_for_custom_post_type() { 'post_type' => 'custom_type', 'post_status' => 'publish', 'post_title' => 'Custom Type Post', - ] + ], ); $post = \get_post( $post_id ); @@ -743,7 +743,7 @@ public function test_republish_overwrites_even_when_original_changed() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -751,7 +751,7 @@ public function test_republish_overwrites_even_when_original_changed() { $base_modified_gmt = ( $original->post_modified_gmt ) ? $original->post_modified_gmt : \get_gmt_from_date( $original->post_modified ); $modified_time_gmt = \gmdate( 'Y-m-d H:i:s', - \strtotime( '+1 second', \strtotime( $base_modified_gmt ) ) + \strtotime( '+1 second', \strtotime( $base_modified_gmt ) ), ); $modified_time = \get_date_from_gmt( $modified_time_gmt ); @@ -764,7 +764,7 @@ public function test_republish_overwrites_even_when_original_changed() { 'post_date_gmt' => $modified_time_gmt, 'post_modified' => $modified_time, 'post_modified_gmt' => $modified_time_gmt, - ] + ], ); // Modify the copy with different content. @@ -773,7 +773,7 @@ public function test_republish_overwrites_even_when_original_changed() { 'ID' => $copy->ID, 'post_title' => 'Copy Title', 'post_content' => 'Copy content.', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -799,7 +799,7 @@ public function test_copy_preserves_original_content_at_creation_time() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -813,7 +813,7 @@ public function test_copy_preserves_original_content_at_creation_time() { 'ID' => $original->ID, 'post_title' => 'Modified Original', 'post_content' => 'Modified content.', - ] + ], ); // Refresh copy - should still have original content. @@ -836,7 +836,7 @@ public function test_rewrite_and_republish_works_for_page() { [ 'post_type' => 'page', 'post_title' => 'Original Page', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -850,7 +850,7 @@ public function test_rewrite_and_republish_works_for_page() { [ 'ID' => $copy->ID, 'post_title' => 'Updated Page Title', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -872,7 +872,7 @@ public function test_trashed_copy_cannot_be_republished() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -881,7 +881,7 @@ public function test_trashed_copy_cannot_be_republished() { [ 'ID' => $copy->ID, 'post_title' => 'Trashed Copy Title', - ] + ], ); \wp_trash_post( $copy->ID ); $copy = \get_post( $copy->ID ); @@ -917,7 +917,7 @@ public function test_republish_updates_author_from_copy() { 'post_author' => $copy_author_id, 'post_title' => 'Updated Title', 'post_content' => 'Updated content.', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -1013,7 +1013,7 @@ public function test_full_rewrite_and_republish_workflow() { 'post_title' => 'Original Title', 'post_content' => 'Original content.', 'post_status' => 'publish', - ] + ], ); // Step 2: Create a Rewrite & Republish copy. @@ -1030,7 +1030,7 @@ public function test_full_rewrite_and_republish_workflow() { 'ID' => $copy->ID, 'post_title' => 'Rewritten Title', 'post_content' => 'Rewritten content.', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -1131,7 +1131,7 @@ public function test_republish_preserves_original_post_slug() { [ 'post_title' => 'Original Title', 'post_name' => 'original-slug', - ] + ], ); // Create a R&R copy. @@ -1142,7 +1142,7 @@ public function test_republish_preserves_original_post_slug() { [ 'ID' => $copy->ID, 'post_title' => 'Completely Different Title', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -1174,7 +1174,7 @@ public function test_republish_with_trashed_original() { [ 'post_title' => 'Original Title', 'post_status' => 'publish', - ] + ], ); // Create a R&R copy. @@ -1191,7 +1191,7 @@ public function test_republish_with_trashed_original() { [ 'ID' => $copy->ID, 'post_title' => 'Updated Title', - ] + ], ); $copy = \get_post( $copy->ID ); @@ -1256,7 +1256,7 @@ static function ( $copy_id, $post_id ) use ( &$action_fired, &$fired_copy_id, &$ $fired_post_id = $post_id; }, 10, - 2 + 2, ); // Delete the copy. @@ -1285,7 +1285,7 @@ public function test_republish_updates_original_even_if_delete_fails() { [ 'post_title' => 'Original Title', 'post_content' => 'Original content.', - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); $copy_id = $copy->ID; @@ -1296,7 +1296,7 @@ public function test_republish_updates_original_even_if_delete_fails() { 'ID' => $copy->ID, 'post_title' => 'Updated Title', 'post_content' => 'Updated content.', - ] + ], ); $copy = \get_post( $copy->ID ); diff --git a/tests/WP/bootstrap.php b/tests/WP/bootstrap.php index dec7ef20f..9799709f9 100644 --- a/tests/WP/bootstrap.php +++ b/tests/WP/bootstrap.php @@ -29,7 +29,7 @@ 'muplugins_loaded', static function () { require_once \dirname( __DIR__, 2 ) . '/duplicate-post.php'; - } + }, ); /* From dea7c7b024e18e5a89c2dfb4ca409f37aac36913 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 4 Jan 2026 01:15:00 +0100 Subject: [PATCH 255/299] Modernize: use null coalesce equals operator ... as allowed and available since PHP 7.4. --- common-functions.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common-functions.php b/common-functions.php index 070b108a2..f607eeb77 100644 --- a/common-functions.php +++ b/common-functions.php @@ -77,11 +77,8 @@ function duplicate_post_clone_post_link( $link = null, $before = '', $after = '' return; } - if ( $link === null ) { - $link = __( 'Copy to a new draft', 'duplicate-post' ); - } - - $link = '' . esc_html( $link ) . ''; + $link ??= __( 'Copy to a new draft', 'duplicate-post' ); + $link = '' . esc_html( $link ) . ''; /** * Filter on the clone link HTML. From 52b84513e6869cba00ca1adb6f446a27fe140e20 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 5 Feb 2026 21:33:05 +0100 Subject: [PATCH 256/299] Modernize: use numeric literal separators Since PHP 7.4, PHP allows using numeric literal separators in integers and floats to improve the readability of long numbers. As this codebase has dropped support for PHP < 7.4 by now, we can apply this modernization to all long numbers in this codebase. Ref: * https://wiki.php.net/rfc/numeric_literal_separator --- tests/WP/Handlers/Save_Post_Handler_Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/WP/Handlers/Save_Post_Handler_Test.php b/tests/WP/Handlers/Save_Post_Handler_Test.php index 76b215ae9..597dafbd2 100644 --- a/tests/WP/Handlers/Save_Post_Handler_Test.php +++ b/tests/WP/Handlers/Save_Post_Handler_Test.php @@ -228,7 +228,7 @@ public function test_delete_on_save_post_does_nothing_for_nonexistent_post() { $_POST['duplicate_post_remove_original'] = '1'; // Call the method with a non-existent post ID - should not throw error. - $this->instance->delete_on_save_post( 999999 ); + $this->instance->delete_on_save_post( 999_999. ); // If we get here without errors, the test passes. } From d4d22c97d09d46f8f5778cfd9f94a65eadfbd743 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 5 Feb 2026 20:59:42 +0100 Subject: [PATCH 257/299] Composer: update test dependencies ... to take advantage of the recently released new version of WP Test Utils. Ref: https://github.com/Yoast/wp-test-utils/releases/tag/1.2.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 220591f2d..ea28ca9e3 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "composer/installers": "^1.12.0 || ^2.0" }, "require-dev": { - "yoast/wp-test-utils": "^1.2.0", + "yoast/wp-test-utils": "^1.2.1", "yoast/yoastcs": "^3.3.0" }, "autoload": { From 2d789cba566cf624dca9f63fc547305ec4590b5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:45:51 +0000 Subject: [PATCH 258/299] GH Actions: Bump actions/checkout in the action-runners group Bumps the action-runners group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 6.0.1 to 6.0.2 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/8e8c483db84b4bee98b60c0593521ed34d9990e8...de0fac2e4500dabe0009e67214ff5f5447ce83dd) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: action-runners ... Signed-off-by: dependabot[bot] --- .github/workflows/cs.yml | 2 +- .github/workflows/deploy.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index efc677abb..c562c1896 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -68,7 +68,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 25c57a31b..c4120d518 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -55,7 +55,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -160,7 +160,7 @@ jobs: fi - name: Checkout Yoast Dist repo - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: repository: ${{ env.DIST_ORG }}/${{ github.event.repository.name }} ref: ${{ env.DIST_DEFAULT_BRANCH }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 557d96ad6..4dabfc589 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -87,7 +87,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bdbc98ff9..1d6935ec7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -87,7 +87,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -198,7 +198,7 @@ jobs: run: sudo apt-get install -y subversion - name: Checkout code - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false From 9d910f564f04e1273ad486b32b98da5d6c6a32dd Mon Sep 17 00:00:00 2001 From: Leonidas Milosis Date: Wed, 11 Feb 2026 11:54:03 +0200 Subject: [PATCH 259/299] Increse CS error threshold --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ea28ca9e3..f9f90d6cc 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "Yoast\\WP\\Duplicate_Post\\Config\\Composer\\Actions::check_coding_standards" ], "check-cs-thresholds": [ - "@putenv YOASTCS_THRESHOLD_ERRORS=57", + "@putenv YOASTCS_THRESHOLD_ERRORS=71", "@putenv YOASTCS_THRESHOLD_WARNINGS=0", "Yoast\\WP\\Duplicate_Post\\Config\\Composer\\Actions::check_cs_thresholds" ], From 6547480705fd339ddd480d946cc27eafd1b8735b Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 15 Feb 2026 19:42:10 +0100 Subject: [PATCH 260/299] CS/QA: int., not float Minor fix-up after 453 --- tests/WP/Handlers/Save_Post_Handler_Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/WP/Handlers/Save_Post_Handler_Test.php b/tests/WP/Handlers/Save_Post_Handler_Test.php index 597dafbd2..7acc152d7 100644 --- a/tests/WP/Handlers/Save_Post_Handler_Test.php +++ b/tests/WP/Handlers/Save_Post_Handler_Test.php @@ -228,7 +228,7 @@ public function test_delete_on_save_post_does_nothing_for_nonexistent_post() { $_POST['duplicate_post_remove_original'] = '1'; // Call the method with a non-existent post ID - should not throw error. - $this->instance->delete_on_save_post( 999_999. ); + $this->instance->delete_on_save_post( 999_999 ); // If we get here without errors, the test passes. } From 99c0b877c0905bbc0e7ccff895400d8259b9a1bf Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 15 Feb 2026 19:46:44 +0100 Subject: [PATCH 261/299] CS: fix up after recent merge PR 452 introduced a number of new, auto-fixable CS issues after the upgrade to YoastCS 3.3.0. These should have been (auto-)fixed. Instead the CS threshold was raised without justification. Fixed now. --- composer.json | 2 +- src/post-republisher.php | 2 +- src/watchers/bulk-actions-watcher.php | 12 ++++++------ tests/Unit/Handlers/Bulk_Handler_Test.php | 10 +++++----- tests/WP/Post_Republisher_Test.php | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index f9f90d6cc..ea28ca9e3 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "Yoast\\WP\\Duplicate_Post\\Config\\Composer\\Actions::check_coding_standards" ], "check-cs-thresholds": [ - "@putenv YOASTCS_THRESHOLD_ERRORS=71", + "@putenv YOASTCS_THRESHOLD_ERRORS=57", "@putenv YOASTCS_THRESHOLD_WARNINGS=0", "Yoast\\WP\\Duplicate_Post\\Config\\Composer\\Actions::check_cs_thresholds" ], diff --git a/src/post-republisher.php b/src/post-republisher.php index c081c3d80..1c3a046ce 100644 --- a/src/post-republisher.php +++ b/src/post-republisher.php @@ -146,7 +146,7 @@ public function republish_request( $post ) { \wp_die( \esc_html__( 'You are not allowed to republish this post.', 'duplicate-post' ), \esc_html__( 'Permission denied', 'duplicate-post' ), - [ 'response' => 403 ] + [ 'response' => 403 ], ); } diff --git a/src/watchers/bulk-actions-watcher.php b/src/watchers/bulk-actions-watcher.php index 1c90603d6..0f975c51e 100644 --- a/src/watchers/bulk-actions-watcher.php +++ b/src/watchers/bulk-actions-watcher.php @@ -74,10 +74,10 @@ public function add_bulk_clone_admin_notice() { '%s item skipped due to insufficient permissions.', '%s items skipped due to insufficient permissions.', $skipped_posts, - 'duplicate-post' - ) + 'duplicate-post', + ), ) . '

', - \esc_html( $skipped_posts ) + \esc_html( $skipped_posts ), ); } } @@ -114,10 +114,10 @@ public function add_bulk_rewrite_and_republish_admin_notice() { '%s item skipped due to insufficient permissions.', '%s items skipped due to insufficient permissions.', $skipped_posts, - 'duplicate-post' - ) + 'duplicate-post', + ), ) . '

', - \esc_html( $skipped_posts ) + \esc_html( $skipped_posts ), ); } } diff --git a/tests/Unit/Handlers/Bulk_Handler_Test.php b/tests/Unit/Handlers/Bulk_Handler_Test.php index 8e62f55a4..9aea1d758 100644 --- a/tests/Unit/Handlers/Bulk_Handler_Test.php +++ b/tests/Unit/Handlers/Bulk_Handler_Test.php @@ -60,12 +60,12 @@ protected function set_up() { public function test_constructor() { $this->assertInstanceOf( Post_Duplicator::class, - $this->getPropertyValue( $this->instance, 'post_duplicator' ) + $this->getPropertyValue( $this->instance, 'post_duplicator' ), ); $this->assertInstanceOf( Permissions_Helper::class, - $this->getPropertyValue( $this->instance, 'permissions_helper' ) + $this->getPropertyValue( $this->instance, 'permissions_helper' ), ); } @@ -138,7 +138,7 @@ public function test_clone_bulk_action_handler_skips_posts_user_cannot_edit() { ->andReturnUsing( static function ( $key, $value, $url ) { return $url . ( ( \strpos( $url, '?' ) === false ) ? '?' : '&' ) . $key . '=' . $value; - } + }, ); $result = $this->instance->clone_bulk_action_handler( $redirect_to, 'duplicate_post_bulk_clone', [ 1, 2 ] ); @@ -245,7 +245,7 @@ public function test_clone_bulk_action_handler_handles_wp_error() { ->andReturnUsing( static function ( $key, $value, $url ) { return $url . ( ( \strpos( $url, '?' ) === false ) ? '?' : '&' ) . $key . '=' . $value; - } + }, ); $result = $this->instance->clone_bulk_action_handler( $redirect_to, 'duplicate_post_bulk_clone', [ 1 ] ); @@ -314,7 +314,7 @@ public function test_rewrite_bulk_action_handler_skips_posts_user_cannot_edit() ->andReturnUsing( static function ( $key, $value, $url ) { return $url . ( ( \strpos( $url, '?' ) === false ) ? '?' : '&' ) . $key . '=' . $value; - } + }, ); $result = $this->instance->rewrite_bulk_action_handler( $redirect_to, 'duplicate_post_bulk_rewrite_republish', [ 1, 2 ] ); diff --git a/tests/WP/Post_Republisher_Test.php b/tests/WP/Post_Republisher_Test.php index 5bb87d8d7..74b614f9d 100644 --- a/tests/WP/Post_Republisher_Test.php +++ b/tests/WP/Post_Republisher_Test.php @@ -980,7 +980,7 @@ public function test_republish_request_dies_when_user_cannot_edit_original() { 'post_title' => 'Admin Post', 'post_content' => 'Admin content.', 'post_author' => $admin_user_id, - ] + ], ); $copy = $this->create_rewrite_and_republish_copy( $original ); @@ -990,7 +990,7 @@ public function test_republish_request_dies_when_user_cannot_edit_original() { [ 'ID' => $copy->ID, 'post_status' => 'dp-rewrite-republish', - ] + ], ); $copy = \get_post( $copy->ID ); From e5d0b31ce1596b0ce5f2c5eab0366a00ecd63ec3 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 4 Feb 2026 16:06:02 +0100 Subject: [PATCH 262/299] Pass copy ID to `redirect` method and defer `delete_copy` logic to `clean_up_after_redirect`. --- src/post-republisher.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/post-republisher.php b/src/post-republisher.php index 1c3a046ce..fc60e0460 100644 --- a/src/post-republisher.php +++ b/src/post-republisher.php @@ -154,7 +154,7 @@ public function republish_request( $post ) { // Trigger the redirect in the Classic Editor. if ( $this->is_classic_editor_post_request() ) { - $this->redirect( $original_post->ID ); + $this->redirect( $original_post->ID, $post->ID ); } } @@ -249,16 +249,23 @@ public function clean_up_orphaned_copy() { } /** - * Cleans up after the user has been redirected to the original post. - * - * Note: The copy is now deleted immediately after republishing, so this method - * only verifies the nonce when the redirect parameters are present. + * Cleans up the copied post and temporary metadata after the user has been redirected. * * @return void */ public function clean_up_after_redirect() { - if ( ! empty( $_GET['dprepublished'] ) && ! empty( $_GET['post'] ) && isset( $_GET['dpnonce'] ) ) { + if ( ! empty( $_GET['dprepublished'] ) && ! empty( $_GET['dpcopy'] ) && ! empty( $_GET['post'] ) ) { + $copy_id = \intval( \wp_unslash( $_GET['dpcopy'] ) ); + $post_id = \intval( \wp_unslash( $_GET['post'] ) ); + \check_admin_referer( 'dp-republish', 'dpnonce' ); + + if ( \intval( \get_post_meta( $copy_id, '_dp_has_been_republished', true ) ) === 1 ) { + $this->delete_copy( $copy_id, $post_id ); + } + else { + \wp_die( \esc_html__( 'An error occurred while deleting the Rewrite & Republish copy.', 'duplicate-post' ) ); + } } } @@ -321,9 +328,6 @@ public function republish( WP_Post $post, WP_Post $original_post ) { // Mark the copy as already published. \update_post_meta( $post->ID, '_dp_has_been_republished', '1' ); - // Delete the copy immediately after republishing. - $this->delete_copy( $post->ID, $original_post->ID ); - // Re-enable the creation of a new revision. \add_action( 'post_updated', 'wp_save_post_revision', 10, 1 ); @@ -443,14 +447,16 @@ protected function republish_post_meta( $post ) { * Redirects the user to the original post. * * @param int $original_post_id The ID of the original post to redirect to. + * @param int $copy_id The ID of the copy post. * * @return void */ - protected function redirect( $original_post_id ) { + protected function redirect( $original_post_id, $copy_id ) { \wp_safe_redirect( \add_query_arg( [ 'dprepublished' => 1, + 'dpcopy' => $copy_id, 'dpnonce' => \wp_create_nonce( 'dp-republish' ), ], \admin_url( 'post.php?action=edit&post=' . $original_post_id ), From d77b776cca9ff7b622ddd085d7b42c9e18d018d4 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 4 Feb 2026 23:40:58 +0100 Subject: [PATCH 263/299] Update `Post_Republisher_Test` to verify copy retention and add meta checks; refactor `delete_copy` test for failure scenarios. --- tests/WP/Post_Republisher_Test.php | 66 ++++++++++++------------------ 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/tests/WP/Post_Republisher_Test.php b/tests/WP/Post_Republisher_Test.php index 74b614f9d..1d6b35db8 100644 --- a/tests/WP/Post_Republisher_Test.php +++ b/tests/WP/Post_Republisher_Test.php @@ -270,8 +270,11 @@ public function test_republish_overwrites_original_content() { // Verify the original is still published. $this->assertEquals( 'publish', $updated_original->post_status ); - // Verify the copy is deleted after republishing. - $this->assertNull( \get_post( $copy->ID ) ); + // Verify the copy is NOT deleted by republish() - deletion is handled separately. + $this->assertNotNull( \get_post( $copy->ID ) ); + + // Verify the copy was marked as republished. + $this->assertEquals( '1', \get_post_meta( $copy->ID, '_dp_has_been_republished', true ) ); } /** @@ -1040,13 +1043,16 @@ public function test_republish_does_not_remove_meta_deleted_from_copy() { } /** - * Tests the full Rewrite & Republish workflow from start to finish. + * Tests the Rewrite & Republish workflow updates original content. + * + * Note: This test verifies that republish() updates the original post content. + * The copy deletion is handled separately by delete_copy() and tested in + * test_full_rewrite_and_republish_workflow_with_delete(). * * @covers ::republish * @covers ::republish_post_elements * @covers ::republish_post_taxonomies * @covers ::republish_post_meta - * @covers ::delete_copy * * @return void */ @@ -1088,9 +1094,11 @@ public function test_full_rewrite_and_republish_workflow() { $this->assertEquals( 'Rewritten content.', $updated_original->post_content ); $this->assertEquals( 'publish', $updated_original->post_status ); - // Step 6: Verify the copy is deleted and meta is cleaned up. - $this->assertNull( \get_post( $copy->ID ) ); - $this->assertEmpty( \get_post_meta( $original->ID, '_dp_has_rewrite_republish_copy', true ) ); + // Step 6: Verify the copy is NOT deleted by republish() - deletion is separate. + $this->assertNotNull( \get_post( $copy->ID ) ); + + // Verify the copy was marked as republished. + $this->assertEquals( '1', \get_post_meta( $copy->ID, '_dp_has_been_republished', true ) ); } /** @@ -1313,36 +1321,22 @@ static function ( $copy_id, $post_id ) use ( &$action_fired, &$fired_copy_id, &$ } /** - * Tests that republish still updates original even if delete_copy fails. + * Tests that delete_copy cleans up meta even if wp_delete_post fails. * - * This verifies the behavior when wp_delete_post() fails during republish. - * The original post should still be updated, and the meta cleanup should still happen. + * This verifies the behavior when wp_delete_post() fails during delete_copy(). + * The meta cleanup should still happen even if the post is not actually deleted. * - * @covers ::republish * @covers ::delete_copy - * @covers ::republish_post_elements * * @return void */ - public function test_republish_updates_original_even_if_delete_fails() { - $original = $this->create_original_post( - [ - 'post_title' => 'Original Title', - 'post_content' => 'Original content.', - ], - ); + public function test_delete_copy_cleans_meta_even_if_wp_delete_post_fails() { + $original = $this->create_original_post(); $copy = $this->create_rewrite_and_republish_copy( $original ); $copy_id = $copy->ID; - // Update copy content. - \wp_update_post( - [ - 'ID' => $copy->ID, - 'post_title' => 'Updated Title', - 'post_content' => 'Updated content.', - ], - ); - $copy = \get_post( $copy->ID ); + // Verify the meta exists before deletion. + $this->assertEquals( $copy_id, (int) \get_post_meta( $original->ID, '_dp_has_rewrite_republish_copy', true ) ); // Prevent deletion by filtering pre_delete_post. $prevent_deletion = static function ( $delete, $post ) use ( $copy_id ) { @@ -1353,17 +1347,12 @@ public function test_republish_updates_original_even_if_delete_fails() { }; \add_filter( 'pre_delete_post', $prevent_deletion, 10, 2 ); - // Republish - delete will fail but republish should still work. - $this->instance->republish( $copy, $original ); + // Call delete_copy - wp_delete_post will fail but meta cleanup should still happen. + $this->instance->delete_copy( $copy_id, $original->ID ); // Remove the filter. \remove_filter( 'pre_delete_post', $prevent_deletion, 10 ); - // Verify the original was still updated despite delete failure. - $updated_original = \get_post( $original->ID ); - $this->assertEquals( 'Updated Title', $updated_original->post_title ); - $this->assertEquals( 'Updated content.', $updated_original->post_content ); - // Verify the copy still exists (because deletion failed). $still_existing_copy = \get_post( $copy_id ); $this->assertNotNull( $still_existing_copy ); @@ -1371,9 +1360,6 @@ public function test_republish_updates_original_even_if_delete_fails() { // Verify the meta was still cleaned up from the original. $this->assertEmpty( \get_post_meta( $original->ID, '_dp_has_rewrite_republish_copy', true ) ); - // Verify the copy was marked as republished. - $this->assertEquals( '1', \get_post_meta( $copy_id, '_dp_has_been_republished', true ) ); - // Clean up manually. \wp_delete_post( $copy_id, true ); } @@ -1484,9 +1470,11 @@ public function test_clean_up_after_redirect_verifies_nonce_with_valid_nonce() { */ public function test_clean_up_after_redirect_dies_with_invalid_nonce() { $original = $this->create_original_post(); + $copy = $this->create_rewrite_and_republish_copy( $original ); // Set the redirect parameters with an invalid nonce. $_GET['dprepublished'] = '1'; + $_GET['dpcopy'] = $copy->ID; $_GET['post'] = $original->ID; $_GET['dpnonce'] = 'invalid_nonce'; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput,WordPress.Security.NonceVerification -- Setting up test data. @@ -1498,6 +1486,6 @@ public function test_clean_up_after_redirect_dies_with_invalid_nonce() { $this->instance->clean_up_after_redirect(); // Clean up (may not be reached due to exception). - unset( $_GET['dprepublished'], $_GET['post'], $_GET['dpnonce'], $_REQUEST['dpnonce'] ); + unset( $_GET['dprepublished'], $_GET['dpcopy'], $_GET['post'], $_GET['dpnonce'], $_REQUEST['dpnonce'] ); } } From 3ce337a63e31936be3adf5eb83228b9d7a08fc85 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Wed, 18 Feb 2026 08:48:09 +0100 Subject: [PATCH 264/299] Update editor button alignment and style; replace `isTertiary` with `variant="secondary"` in React components --- css/duplicate-post.css | 4 ++-- js/src/duplicate-post-edit-script.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/css/duplicate-post.css b/css/duplicate-post.css index efbd33867..fb437e422 100644 --- a/css/duplicate-post.css +++ b/css/duplicate-post.css @@ -32,8 +32,8 @@ /* Copy links in the block editor. */ .components-button.dp-editor-post-copy-to-draft, .components-button.dp-editor-post-rewrite-republish { - margin-left: -6px; - text-decoration: underline; + width: 100%; + justify-content: center; } #check-changes-action { diff --git a/js/src/duplicate-post-edit-script.js b/js/src/duplicate-post-edit-script.js index 19567209e..3587ef8d0 100644 --- a/js/src/duplicate-post-edit-script.js +++ b/js/src/duplicate-post-edit-script.js @@ -138,7 +138,7 @@ function DuplicatePostRender() { { ( duplicatePost.newDraftLink !== '' && duplicatePost.showLinks.new_draft === '1' ) &&