Commit d20c58630f5 for woocommerce
commit d20c58630f5875fe431ad0ee8fdc21f5a899f161
Author: Christopher Hertel <mail@christopher-hertel.de>
Date: Fri Nov 13 11:03:19 2026 +0100
Skip feature-gated abilities in the loader coverage test (#70942)
The coverage test compared every name in CORE_ABILITY_DEFINITION_CLASSES
with the canonical list. The agent readiness ability reports an empty
name while its feature is off, which the loader skips, so the test
failed on trunk once both changes landed.
diff --git a/plugins/woocommerce/changelog/fix-abilities-loader-test-feature-gated b/plugins/woocommerce/changelog/fix-abilities-loader-test-feature-gated
new file mode 100644
index 00000000000..4edbe802c67
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-abilities-loader-test-feature-gated
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+Comment: Skip feature-gated abilities in the abilities loader coverage test; no production change.
+
diff --git a/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php b/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php
index de848f95d03..fc9d29ee1d4 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php
@@ -998,10 +998,12 @@ class AbilitiesLoaderTest extends \WC_Unit_Test_Case {
*/
public function test_permission_refusal_provider_covers_every_canonical_ability(): void {
$classes = ( new \ReflectionClassConstant( AbilitiesLoader::class, 'CORE_ABILITY_DEFINITION_CLASSES' ) )->getValue();
- $core = array_map(
+ $names = array_map(
static fn( string $class_name ): string => is_a( $class_name, ActionableAbility::class, true ) ? $class_name::ABILITY_NAME : $class_name::get_name(),
$classes
);
+ // The loader skips an empty name, which a feature-gated ability reports while its feature is off.
+ $core = array_values( array_filter( $names, static fn( string $name ): bool => '' !== $name ) );
$covered = array_column( $this->provider_canonical_abilities_with_minimal_input(), 0 );
$this->assertEqualsCanonicalizing( $core, self::CANONICAL_ABILITY_IDS, 'CANONICAL_ABILITY_IDS should list every Core ability.' );