From 2b565248d3a2560609f38bae85f3f32f79ab06b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 15:18:21 +0000 Subject: [PATCH 1/9] Bump the composer group across 1 directories with 1 update Bumps the composer group with 1 update in the /. directory: [composer/composer](https://github.com/composer/composer). Updates `composer/composer` from 2.2.22 to 2.2.23 - [Release notes](https://github.com/composer/composer/releases) - [Changelog](https://github.com/composer/composer/blob/main/CHANGELOG.md) - [Commits](https://github.com/composer/composer/compare/2.2.22...2.2.23) --- updated-dependencies: - dependency-name: composer/composer dependency-type: indirect ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 370596c..4e05fb8 100644 --- a/composer.lock +++ b/composer.lock @@ -1184,16 +1184,16 @@ }, { "name": "composer/composer", - "version": "2.2.22", + "version": "2.2.23", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "fedc76ee3f3e3d57d20993b9f4c5fcfb2f8596aa" + "reference": "d1542e89636abf422fde328cb28d53752efb69e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/fedc76ee3f3e3d57d20993b9f4c5fcfb2f8596aa", - "reference": "fedc76ee3f3e3d57d20993b9f4c5fcfb2f8596aa", + "url": "https://api.github.com/repos/composer/composer/zipball/d1542e89636abf422fde328cb28d53752efb69e5", + "reference": "d1542e89636abf422fde328cb28d53752efb69e5", "shasum": "" }, "require": { @@ -1263,7 +1263,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.2.22" + "source": "https://github.com/composer/composer/tree/2.2.23" }, "funding": [ { @@ -1279,7 +1279,7 @@ "type": "tidelift" } ], - "time": "2023-09-29T08:53:46+00:00" + "time": "2024-02-08T14:08:53+00:00" }, { "name": "composer/metadata-minifier", From 752be0980187bfa5a1cbe3ff8b875acc58a41a98 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 14 Feb 2024 13:26:56 -0700 Subject: [PATCH 2/9] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 69e9d8d..bd564aa 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -37,7 +37,7 @@ body: description: >- Paste or attach the PHP or JSON export of the ACF Field Group(s) related to the problem. - Attach as Github supported file type, ie .txt or .zip + Attach as Github supported file type, ie .txt or .zip. I recommend exporting the ACF Field group as JSON then compressing as a .zip to upload. - type: textarea attributes: label: Additional context From 5b656364fcc9348f588d99e9c7c5c5f92b041834 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 14 Feb 2024 14:00:25 -0700 Subject: [PATCH 3/9] - default orderby to 'include' for Taxonomy field --- src/FieldType/Taxonomy.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FieldType/Taxonomy.php b/src/FieldType/Taxonomy.php index 44334b1..cb46e44 100644 --- a/src/FieldType/Taxonomy.php +++ b/src/FieldType/Taxonomy.php @@ -45,6 +45,7 @@ static function ( $id ) { } $args['where']['include'] = $ids; + $args['where']['orderby'] = $args['where']['orderby'] ?? 'include'; return ( new TermObjectConnectionResolver( $root, $args, $context, $info ) )->get_connection(); }, From 305d254e565b53402b749a77605dc4279b5c8bf1 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 14 Feb 2024 14:35:43 -0700 Subject: [PATCH 4/9] - add test to ensure taxonomy field resolves in the same order the IDs are saved - update taxonomy field resolver to se the default order and orderby when resolving with the TermObjectConnectionResolver --- composer.lock | 338 +++++++++++++----- src/FieldType/Taxonomy.php | 3 + tests/wpunit/FieldTypes/TaxonomyFieldTest.php | 96 +++++ 3 files changed, 344 insertions(+), 93 deletions(-) diff --git a/composer.lock b/composer.lock index 6de53cd..1018f72 100644 --- a/composer.lock +++ b/composer.lock @@ -158,16 +158,16 @@ }, { "name": "axepress/wp-graphql-stubs", - "version": "v1.18.2", + "version": "v1.21.0", "source": { "type": "git", "url": "https://github.com/AxeWP/wp-graphql-stubs.git", - "reference": "3f5636778cbff0fc4383cf896df6a99d593b62d6" + "reference": "4576d7a7b4e5c9117d841bbe2b340e623f566942" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AxeWP/wp-graphql-stubs/zipball/3f5636778cbff0fc4383cf896df6a99d593b62d6", - "reference": "3f5636778cbff0fc4383cf896df6a99d593b62d6", + "url": "https://api.github.com/repos/AxeWP/wp-graphql-stubs/zipball/4576d7a7b4e5c9117d841bbe2b340e623f566942", + "reference": "4576d7a7b4e5c9117d841bbe2b340e623f566942", "shasum": "" }, "require": { @@ -198,7 +198,7 @@ ], "support": { "issues": "https://github.com/AxeWP/wp-graphql-stubs/issues", - "source": "https://github.com/AxeWP/wp-graphql-stubs/tree/v1.18.2" + "source": "https://github.com/AxeWP/wp-graphql-stubs/tree/v1.21.0" }, "funding": [ { @@ -206,7 +206,7 @@ "type": "github" } ], - "time": "2023-11-11T14:05:57+00:00" + "time": "2024-02-11T16:43:25+00:00" }, { "name": "behat/gherkin", @@ -1182,41 +1182,123 @@ ], "time": "2023-12-18T12:05:55+00:00" }, + { + "name": "composer/class-map-generator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/composer/class-map-generator.git", + "reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/953cc4ea32e0c31f2185549c7d216d7921f03da9", + "reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9", + "shasum": "" + }, + "require": { + "composer/pcre": "^2.1 || ^3.1", + "php": "^7.2 || ^8.0", + "symfony/finder": "^4.4 || ^5.3 || ^6 || ^7" + }, + "require-dev": { + "phpstan/phpstan": "^1.6", + "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/filesystem": "^5.4 || ^6", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\ClassMapGenerator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Utilities to scan PHP code and generate class maps.", + "keywords": [ + "classmap" + ], + "support": { + "issues": "https://github.com/composer/class-map-generator/issues", + "source": "https://github.com/composer/class-map-generator/tree/1.1.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2023-06-30T13:58:57+00:00" + }, { "name": "composer/composer", - "version": "2.2.23", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "d1542e89636abf422fde328cb28d53752efb69e5" + "reference": "aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/d1542e89636abf422fde328cb28d53752efb69e5", - "reference": "d1542e89636abf422fde328cb28d53752efb69e5", + "url": "https://api.github.com/repos/composer/composer/zipball/aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc", + "reference": "aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", + "composer/class-map-generator": "^1.0", "composer/metadata-minifier": "^1.0", - "composer/pcre": "^1.0", - "composer/semver": "^3.0", - "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^2.0 || ^3.0", + "composer/pcre": "^2.1 || ^3.1", + "composer/semver": "^3.2.5", + "composer/spdx-licenses": "^1.5.7", + "composer/xdebug-handler": "^2.0.2 || ^3.0.3", "justinrainbow/json-schema": "^5.2.11", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0 || ^2.0", - "react/promise": "^1.2 || ^2.7", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "react/promise": "^2.8 || ^3", "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", - "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0" + "seld/phar-utils": "^1.2", + "seld/signal-handler": "^2.0", + "symfony/console": "^5.4.11 || ^6.0.11 || ^7", + "symfony/filesystem": "^5.4 || ^6.0 || ^7", + "symfony/finder": "^5.4 || ^6.0 || ^7", + "symfony/polyfill-php73": "^1.24", + "symfony/polyfill-php80": "^1.24", + "symfony/polyfill-php81": "^1.24", + "symfony/process": "^5.4 || ^6.0 || ^7" }, "require-dev": { - "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" + "phpstan/phpstan": "^1.9.3", + "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1", + "phpstan/phpstan-symfony": "^1.2.10", + "symfony/phpunit-bridge": "^6.4.1 || ^7.0.1" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -1229,12 +1311,17 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.2-dev" + "dev-main": "2.7-dev" + }, + "phpstan": { + "includes": [ + "phpstan/rules.neon" + ] } }, "autoload": { "psr-4": { - "Composer\\": "src/Composer" + "Composer\\": "src/Composer/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1263,7 +1350,8 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.2.23" + "security": "https://github.com/composer/composer/security/policy", + "source": "https://github.com/composer/composer/tree/2.7.1" }, "funding": [ { @@ -1279,7 +1367,7 @@ "type": "tidelift" } ], - "time": "2024-02-08T14:08:53+00:00" + "time": "2024-02-09T14:26:28+00:00" }, { "name": "composer/metadata-minifier", @@ -1352,30 +1440,30 @@ }, { "name": "composer/pcre", - "version": "1.0.1", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" + "reference": "b439557066cd445732fa57cbc8d905394b4db8a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "url": "https://api.github.com/repos/composer/pcre/zipball/b439557066cd445732fa57cbc8d905394b4db8a0", + "reference": "b439557066cd445732fa57cbc8d905394b4db8a0", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5" + "symfony/phpunit-bridge": "^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -1403,7 +1491,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.1" + "source": "https://github.com/composer/pcre/tree/2.1.1" }, "funding": [ { @@ -1419,7 +1507,7 @@ "type": "tidelift" } ], - "time": "2022-01-21T20:24:37+00:00" + "time": "2023-10-11T07:10:55+00:00" }, { "name": "composer/semver", @@ -2832,16 +2920,16 @@ }, { "name": "mck89/peast", - "version": "v1.16.0", + "version": "v1.16.1", "source": { "type": "git", "url": "https://github.com/mck89/peast.git", - "reference": "63dee902bd281c792f1dd760b6df268682032ed0" + "reference": "f6e681062bb25c8dacbd30e079f4ad3fd890d7ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mck89/peast/zipball/63dee902bd281c792f1dd760b6df268682032ed0", - "reference": "63dee902bd281c792f1dd760b6df268682032ed0", + "url": "https://api.github.com/repos/mck89/peast/zipball/f6e681062bb25c8dacbd30e079f4ad3fd890d7ad", + "reference": "f6e681062bb25c8dacbd30e079f4ad3fd890d7ad", "shasum": "" }, "require": { @@ -2854,7 +2942,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.16.0-dev" + "dev-master": "1.16.1-dev" } }, "autoload": { @@ -2875,9 +2963,9 @@ "description": "Peast is PHP library that generates AST for JavaScript code", "support": { "issues": "https://github.com/mck89/peast/issues", - "source": "https://github.com/mck89/peast/tree/v1.16.0" + "source": "https://github.com/mck89/peast/tree/v1.16.1" }, - "time": "2024-01-11T14:36:12+00:00" + "time": "2024-02-14T08:15:19+00:00" }, { "name": "mikehaertl/php-shellcommand", @@ -3464,16 +3552,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.4.1", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "6d6063cf9464a306ca2a0529705d41312b08500b" + "reference": "6105bdab2f26c0204fe90ecc53d5684754550e8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/6d6063cf9464a306ca2a0529705d41312b08500b", - "reference": "6d6063cf9464a306ca2a0529705d41312b08500b", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/6105bdab2f26c0204fe90ecc53d5684754550e8f", + "reference": "6105bdab2f26c0204fe90ecc53d5684754550e8f", "shasum": "" }, "require-dev": { @@ -3482,9 +3570,9 @@ "php": "^7.4 || ~8.0.0", "php-stubs/generator": "^0.8.3", "phpdocumentor/reflection-docblock": "^5.3", - "phpstan/phpstan": "^1.10.12", + "phpstan/phpstan": "^1.10.49", "phpunit/phpunit": "^9.5", - "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.11" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", @@ -3505,9 +3593,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.4.1" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.4.3" }, - "time": "2023-11-10T00:33:47+00:00" + "time": "2024-02-11T18:56:19+00:00" }, { "name": "php-webdriver/webdriver", @@ -4008,16 +4096,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.57", + "version": "1.10.58", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" + "reference": "a23518379ec4defd9e47cbf81019526861623ec2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2", + "reference": "a23518379ec4defd9e47cbf81019526861623ec2", "shasum": "" }, "require": { @@ -4066,7 +4154,7 @@ "type": "tidelift" } ], - "time": "2024-01-24T11:51:34+00:00" + "time": "2024-02-12T20:02:57+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4836,23 +4924,24 @@ }, { "name": "react/promise", - "version": "v2.11.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831" + "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/1a8460931ea36dc5c76838fec5734d55c88c6831", - "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831", + "url": "https://api.github.com/repos/reactphp/promise/zipball/e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", + "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" }, "type": "library", "autoload": { @@ -4896,7 +4985,7 @@ ], "support": { "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.11.0" + "source": "https://github.com/reactphp/promise/tree/v3.1.0" }, "funding": [ { @@ -4904,7 +4993,7 @@ "type": "open_collective" } ], - "time": "2023-11-16T16:16:50+00:00" + "time": "2023-11-16T16:21:57+00:00" }, { "name": "sebastian/cli-parser", @@ -5982,6 +6071,67 @@ }, "time": "2022-08-31T10:31:18+00:00" }, + { + "name": "seld/signal-handler", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/signal-handler.git", + "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/signal-handler/zipball/04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98", + "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "require-dev": { + "phpstan/phpstan": "^1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^7.5.20 || ^8.5.23", + "psr/log": "^1 || ^2 || ^3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\Signal\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development", + "keywords": [ + "posix", + "sigint", + "signal", + "sigterm", + "unix" + ], + "support": { + "issues": "https://github.com/Seldaek/signal-handler/issues", + "source": "https://github.com/Seldaek/signal-handler/tree/2.0.2" + }, + "time": "2023-09-03T09:24:00+00:00" + }, { "name": "simpod/php-coveralls-mirror", "version": "v3.0.1", @@ -9070,20 +9220,20 @@ }, { "name": "wp-cli/entity-command", - "version": "v2.5.6", + "version": "v2.6.2", "source": { "type": "git", "url": "https://github.com/wp-cli/entity-command.git", - "reference": "45d4f3a77b7977fee4b4f7e183e692ab84bf7dd8" + "reference": "2b5d5d54550edb7383ebaa77fb3a2d53871ba19a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/45d4f3a77b7977fee4b4f7e183e692ab84bf7dd8", - "reference": "45d4f3a77b7977fee4b4f7e183e692ab84bf7dd8", + "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/2b5d5d54550edb7383ebaa77fb3a2d53871ba19a", + "reference": "2b5d5d54550edb7383ebaa77fb3a2d53871ba19a", "shasum": "" }, "require": { - "wp-cli/wp-cli": "^2.5" + "wp-cli/wp-cli": "^2.10" }, "require-dev": { "wp-cli/cache-command": "^1 || ^2", @@ -9156,6 +9306,8 @@ "option patch", "option pluck", "option update", + "option set-autoload", + "option get-autoload", "post", "post create", "post delete", @@ -9179,6 +9331,7 @@ "post term remove", "post term set", "post update", + "post url-to-id", "post-type", "post-type get", "post-type list", @@ -9275,9 +9428,9 @@ "homepage": "https://github.com/wp-cli/entity-command", "support": { "issues": "https://github.com/wp-cli/entity-command/issues", - "source": "https://github.com/wp-cli/entity-command/tree/v2.5.6" + "source": "https://github.com/wp-cli/entity-command/tree/v2.6.2" }, - "time": "2023-10-13T13:38:49+00:00" + "time": "2024-02-06T13:38:03+00:00" }, { "name": "wp-cli/eval-command", @@ -9402,21 +9555,21 @@ }, { "name": "wp-cli/extension-command", - "version": "v2.1.17", + "version": "v2.1.19", "source": { "type": "git", "url": "https://github.com/wp-cli/extension-command.git", - "reference": "955bd947d95ef91da501179c7e561d229ab3cc19" + "reference": "80713703e090fbc74926af6f75bf963619f76fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/955bd947d95ef91da501179c7e561d229ab3cc19", - "reference": "955bd947d95ef91da501179c7e561d229ab3cc19", + "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/80713703e090fbc74926af6f75bf963619f76fdb", + "reference": "80713703e090fbc74926af6f75bf963619f76fdb", "shasum": "" }, "require": { "composer/semver": "^1.4 || ^2 || ^3", - "wp-cli/wp-cli": "^2.5.1" + "wp-cli/wp-cli": "^2.10" }, "require-dev": { "wp-cli/cache-command": "^2.0", @@ -9494,9 +9647,9 @@ "homepage": "https://github.com/wp-cli/extension-command", "support": { "issues": "https://github.com/wp-cli/extension-command/issues", - "source": "https://github.com/wp-cli/extension-command/tree/v2.1.17" + "source": "https://github.com/wp-cli/extension-command/tree/v2.1.19" }, - "time": "2024-01-11T11:03:21+00:00" + "time": "2024-02-05T14:53:09+00:00" }, { "name": "wp-cli/i18n-command", @@ -10506,16 +10659,16 @@ }, { "name": "wp-cli/wp-cli", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7" + "reference": "a339dca576df73c31af4b4d8054efc2dab9a0685" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", - "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/a339dca576df73c31af4b4d8054efc2dab9a0685", + "reference": "a339dca576df73c31af4b4d8054efc2dab9a0685", "shasum": "" }, "require": { @@ -10545,7 +10698,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.9.x-dev" + "dev-main": "2.10.x-dev" } }, "autoload": { @@ -10572,24 +10725,23 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2023-10-25T09:06:37+00:00" + "time": "2024-02-08T16:52:43+00:00" }, { "name": "wp-cli/wp-cli-bundle", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli-bundle.git", - "reference": "3512737e69e55507172e8dce400e09231ba95919" + "reference": "b795ca19f12bf9605dc8d85235d55a721b43064c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli-bundle/zipball/3512737e69e55507172e8dce400e09231ba95919", - "reference": "3512737e69e55507172e8dce400e09231ba95919", + "url": "https://api.github.com/repos/wp-cli/wp-cli-bundle/zipball/b795ca19f12bf9605dc8d85235d55a721b43064c", + "reference": "b795ca19f12bf9605dc8d85235d55a721b43064c", "shasum": "" }, "require": { - "composer/composer": "^1.10.23 || ~2.2.17", "php": ">=5.6", "wp-cli/cache-command": "^2", "wp-cli/checksum-command": "^2.1", @@ -10616,7 +10768,7 @@ "wp-cli/shell-command": "^2", "wp-cli/super-admin-command": "^2", "wp-cli/widget-command": "^2", - "wp-cli/wp-cli": "^2.9.0" + "wp-cli/wp-cli": "^2.10.0" }, "require-dev": { "roave/security-advisories": "dev-latest", @@ -10646,7 +10798,7 @@ "issues": "https://github.com/wp-cli/wp-cli-bundle/issues", "source": "https://github.com/wp-cli/wp-cli-bundle" }, - "time": "2023-10-25T09:28:58+00:00" + "time": "2024-02-08T17:05:33+00:00" }, { "name": "wp-cli/wp-config-transformer", @@ -10894,5 +11046,5 @@ "platform-overrides": { "php": "7.3" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/src/FieldType/Taxonomy.php b/src/FieldType/Taxonomy.php index cb46e44..2561e2d 100644 --- a/src/FieldType/Taxonomy.php +++ b/src/FieldType/Taxonomy.php @@ -44,10 +44,13 @@ static function ( $id ) { return null; } + // set the default ordering if not overridden by args input on the field $args['where']['include'] = $ids; $args['where']['orderby'] = $args['where']['orderby'] ?? 'include'; + $args['where']['order'] = $args['where']['order'] ?? 'ASC'; return ( new TermObjectConnectionResolver( $root, $args, $context, $info ) )->get_connection(); + }, ]; diff --git a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php index 9bd8621..b94d302 100644 --- a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php +++ b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php @@ -93,6 +93,100 @@ public function get_expected_block_fragment_response() { ]; } + public function testQueryReturnsTermsInOrderTheyWereSaved() { + + $field_key = $this->register_acf_field([ + 'type' => 'taxonomy', + 'name' => 'tax_term_order_test', + 'show_in_graphql' => true, + 'graphql_field_name' => 'termOrderTest', + 'required' => 1, + 'taxonomy' => 'category', + 'add_term' => 0, + 'save_terms' => 0, + 'load_terms' => 0, + 'return_format' => 'id', + 'field_type' => 'multi_select', + 'multiple' => 1, + 'bidirectonal' => 0, + 'bidirectional_target' => [], + ], [ + 'name' => 'Taxonomy Order Test', + 'graphql_field_name' => 'TaxonomyOrderTest', + 'location' => [ + [ + [ + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post', + ] + ] + ], + 'graphql_types' => [ 'Post' ], + ]); + + $cat_aaa = self::factory()->category->create([ + 'name' => 'AAA' + ]); + + $cat_bbb = self::factory()->category->create([ + 'name' => 'BBB' + ]); + + $cat_ccc = self::factory()->category->create([ + 'name' => 'CCC' + ]); + + $cats = [$cat_ccc, $cat_aaa, $cat_bbb]; + + update_field( $field_key, $cats, $this->published_post ); + + $query = ' + query GetPost($id:ID!) { + post(id:$id idType:DATABASE_ID) { + id + databaseId + taxonomyOrderTest { + termOrderTest { + nodes { + __typename + databaseId + } + } + } + } + } + '; + + $actual = $this->graphql([ + 'query' => $query, + 'variables' => [ + 'id' => $this->published_post->ID, + ] + ]); + + codecept_debug( [ + '$actual' => $actual, + '$cats' => $cats, + ]); + + self::assertQuerySuccessful( $actual, [ + $this->expectedNode( 'post.taxonomyOrderTest.termOrderTest.nodes', [ + '__typename' => 'Category', + 'databaseId' => $cats[0] + ], 0 ), + $this->expectedNode( 'post.taxonomyOrderTest.termOrderTest.nodes', [ + '__typename' => 'Category', + 'databaseId' => $cats[1] + ], 1 ), + $this->expectedNode( 'post.taxonomyOrderTest.termOrderTest.nodes', [ + '__typename' => 'Category', + 'databaseId' => $cats[2] + ], 2 ), + ]); + + } + public function testQueryTaxononomyFieldOnBlock() { // if ACF PRO is not active, skip the test @@ -294,4 +388,6 @@ interfaces { wp_delete_term( $category_id, 'category' ); wp_delete_term( $category_2_id, 'category' ); } + + } From 7c52d67fcfb84fe19b44ad8fa74ec6193c1b6019 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 14 Feb 2024 14:48:19 -0700 Subject: [PATCH 5/9] - composer fix-cs --- src/FieldType/Taxonomy.php | 1 - tests/wpunit/FieldTypes/TaxonomyFieldTest.php | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/FieldType/Taxonomy.php b/src/FieldType/Taxonomy.php index 2561e2d..7775557 100644 --- a/src/FieldType/Taxonomy.php +++ b/src/FieldType/Taxonomy.php @@ -50,7 +50,6 @@ static function ( $id ) { $args['where']['order'] = $args['where']['order'] ?? 'ASC'; return ( new TermObjectConnectionResolver( $root, $args, $context, $info ) )->get_connection(); - }, ]; diff --git a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php index b94d302..8be4ad5 100644 --- a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php +++ b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php @@ -185,6 +185,10 @@ public function testQueryReturnsTermsInOrderTheyWereSaved() { ], 2 ), ]); + foreach ( $cats as $cat ) { + wp_delete_term( $cat, 'category' ); + } + } public function testQueryTaxononomyFieldOnBlock() { From 3586a07c2a92672e5a6fe3769fb120ebee7a279f Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Tue, 20 Feb 2024 09:44:05 -0700 Subject: [PATCH 6/9] - when a Taxonomy field is set to store objects instead of IDs, the resolver returns incorrect information. This resolves that by accounting for IDs or Objects being stored and returned. --- src/FieldType/Taxonomy.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/FieldType/Taxonomy.php b/src/FieldType/Taxonomy.php index 44334b1..8672509 100644 --- a/src/FieldType/Taxonomy.php +++ b/src/FieldType/Taxonomy.php @@ -34,7 +34,14 @@ public static function register_field_type(): void { } $ids = array_map( - static function ( $id ) { + static function ( $value ) { + $id = null; + if ( is_array( $value ) ) { + $id = $value['term_id']; + } + if ( isset( $value->term_id ) ) { + $id = $value->term_id; + } return absint( $id ); }, $values From 21eec1f63c6d85ec6ec1d6087b29eb803c1fbf0a Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Tue, 20 Feb 2024 12:08:33 -0700 Subject: [PATCH 7/9] - update Taxonomy.php to better handle different values returned (object vs id & array vs individual value) - add test for Taxonomy field when 'object' is set as the return type --- composer.lock | 32 +++---- src/FieldType/Taxonomy.php | 19 +++-- tests/wpunit/FieldTypes/TaxonomyFieldTest.php | 83 +++++++++++++++++++ 3 files changed, 110 insertions(+), 24 deletions(-) diff --git a/composer.lock b/composer.lock index 1018f72..1dae775 100644 --- a/composer.lock +++ b/composer.lock @@ -1859,16 +1859,16 @@ }, { "name": "doctrine/inflector", - "version": "2.0.9", + "version": "2.0.10", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65" + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc", + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc", "shasum": "" }, "require": { @@ -1930,7 +1930,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.9" + "source": "https://github.com/doctrine/inflector/tree/2.0.10" }, "funding": [ { @@ -1946,7 +1946,7 @@ "type": "tidelift" } ], - "time": "2024-01-15T18:05:13+00:00" + "time": "2024-02-18T20:23:39+00:00" }, { "name": "doctrine/instantiator", @@ -4096,16 +4096,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.58", + "version": "1.10.59", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "a23518379ec4defd9e47cbf81019526861623ec2" + "reference": "e607609388d3a6d418a50a49f7940e8086798281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2", - "reference": "a23518379ec4defd9e47cbf81019526861623ec2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", + "reference": "e607609388d3a6d418a50a49f7940e8086798281", "shasum": "" }, "require": { @@ -4154,7 +4154,7 @@ "type": "tidelift" } ], - "time": "2024-02-12T20:02:57+00:00" + "time": "2024-02-20T13:59:13+00:00" }, { "name": "phpunit/php-code-coverage", @@ -6413,16 +6413,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", "shasum": "" }, "require": { @@ -6489,7 +6489,7 @@ "type": "open_collective" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2024-02-16T15:06:51+00:00" }, { "name": "symfony/browser-kit", diff --git a/src/FieldType/Taxonomy.php b/src/FieldType/Taxonomy.php index 9b8b3fc..db5a4fc 100644 --- a/src/FieldType/Taxonomy.php +++ b/src/FieldType/Taxonomy.php @@ -33,30 +33,33 @@ public static function register_field_type(): void { $values = $value; } - $ids = array_map( + $ids = array_filter( array_map( static function ( $value ) { - $id = null; - if ( is_array( $value ) ) { + $id = $value; + if ( is_array( $value ) && isset( $value['term_id'] ) ) { $id = $value['term_id']; } if ( isset( $value->term_id ) ) { $id = $value->term_id; } - return absint( $id ); + + $id = absint( $id ); + return ! empty( $id ) ? $id : null; }, $values - ); + ) ); if ( empty( $ids ) ) { return null; } // set the default ordering if not overridden by args input on the field - $args['where']['include'] = $ids; + $args['where']['include'] = array_values( $ids ); $args['where']['orderby'] = $args['where']['orderby'] ?? 'include'; $args['where']['order'] = $args['where']['order'] ?? 'ASC'; - - return ( new TermObjectConnectionResolver( $root, $args, $context, $info ) )->get_connection(); + $args['first'] = count( $ids ); + $resolver = new TermObjectConnectionResolver( $root, $args, $context, $info, 'any' ); + return $resolver->get_connection(); }, ]; diff --git a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php index 8be4ad5..5e03690 100644 --- a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php +++ b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php @@ -393,5 +393,88 @@ interfaces { wp_delete_term( $category_2_id, 'category' ); } + public function testTaxonomyFieldReturnsExpectedNodeWhenObjectIsSavedInsteadOfId() { + + register_taxonomy( 'test_taxonomy', 'post', [ + 'show_in_graphql' => true, + 'graphql_single_name' => 'TestCustomTaxonomy', + 'graphql_plural_name' => 'TestCustomTaxonomies', + ] ); + + $term_object = self::factory()->term->create_and_get( [ + 'taxonomy' => 'test_taxonomy', + 'name' => 'Test Term', + ] ); + + $field_key = $this->register_acf_field([ + 'type' => 'taxonomy', + 'name' => 'taxonomy_field_test', + 'show_in_graphql' => true, + 'graphql_field_name' => 'testTaxonomyField', + 'required' => 1, + 'taxonomy' => 'category', + 'add_term' => 0, + 'save_terms' => 0, + 'load_terms' => 0, + 'return_format' => 'object', + 'field_type' => 'select', + 'multiple' => 0, + 'bidirectonal' => 0, + 'bidirectional_target' => [], + ], [ + 'name' => 'Post Taxonomy Test', + 'graphql_field_name' => 'TaxonomyFieldTest', + 'location' => [ + [ + [ + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post', + ] + ] + ], + 'graphql_types' => [ 'Post' ], + ]); + + update_field( $field_key, $term_object->term_id, $this->published_post->ID ); + + $query = ' + query GetPostAndTaxonomyField( $id: ID! ){ + post(id:$id idType:DATABASE_ID) { + id + title + taxonomyFieldTest { + testTaxonomyField { + nodes { + __typename + databaseId + } + } + } + } + }'; + + $variables = [ + 'id' => $this->published_post->ID, + ]; + + $actual = $this->graphql([ + 'query' => $query, + 'variables' => $variables, + ]); + + self::assertQuerySuccessful( $actual, [ + $this->expectedNode( 'post.taxonomyFieldTest.testTaxonomyField.nodes', [ + '__typename' => 'TestCustomTaxonomy', + 'databaseId' => $term_object->term_id, + ], 0 ), + ]); + + // cleanup + unregister_taxonomy( 'test_taxonomy' ); + wp_delete_term( $term_object->term_id, 'test_taxonomy' ); + + } + } From bfe55b1f1ceb70dc31620a90387e4cddfced28c6 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Tue, 20 Feb 2024 12:11:21 -0700 Subject: [PATCH 8/9] - composer fix-cs --- src/FieldType/Taxonomy.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/FieldType/Taxonomy.php b/src/FieldType/Taxonomy.php index db5a4fc..6cdd459 100644 --- a/src/FieldType/Taxonomy.php +++ b/src/FieldType/Taxonomy.php @@ -33,21 +33,23 @@ public static function register_field_type(): void { $values = $value; } - $ids = array_filter( array_map( - static function ( $value ) { - $id = $value; - if ( is_array( $value ) && isset( $value['term_id'] ) ) { - $id = $value['term_id']; - } - if ( isset( $value->term_id ) ) { - $id = $value->term_id; - } + $ids = array_filter( + array_map( + static function ( $value ) { + $id = $value; + if ( is_array( $value ) && isset( $value['term_id'] ) ) { + $id = $value['term_id']; + } + if ( isset( $value->term_id ) ) { + $id = $value->term_id; + } - $id = absint( $id ); - return ! empty( $id ) ? $id : null; - }, - $values - ) ); + $id = absint( $id ); + return ! empty( $id ) ? $id : null; + }, + $values + ) + ); if ( empty( $ids ) ) { return null; @@ -58,7 +60,7 @@ static function ( $value ) { $args['where']['orderby'] = $args['where']['orderby'] ?? 'include'; $args['where']['order'] = $args['where']['order'] ?? 'ASC'; $args['first'] = count( $ids ); - $resolver = new TermObjectConnectionResolver( $root, $args, $context, $info, 'any' ); + $resolver = new TermObjectConnectionResolver( $root, $args, $context, $info, 'any' ); return $resolver->get_connection(); }, ]; From 56265339611af61209d2c4ce91e63465d3d908c9 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Tue, 20 Feb 2024 12:28:39 -0700 Subject: [PATCH 9/9] - change order of cleanup --- tests/wpunit/FieldTypes/TaxonomyFieldTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php index 5e03690..3ee8c42 100644 --- a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php +++ b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php @@ -471,8 +471,8 @@ public function testTaxonomyFieldReturnsExpectedNodeWhenObjectIsSavedInsteadOfId ]); // cleanup - unregister_taxonomy( 'test_taxonomy' ); wp_delete_term( $term_object->term_id, 'test_taxonomy' ); + unregister_taxonomy( 'test_taxonomy' ); }