From 5215d6ef614232e95adcea06a7e472f6b86ff3b5 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Thu, 2 Apr 2026 16:49:55 -0700 Subject: [PATCH 1/4] Add behat test for config has after concatenation assignment --- features/config-has.feature | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/features/config-has.feature b/features/config-has.feature index 332aaa22..b625e54f 100644 --- a/features/config-has.feature +++ b/features/config-has.feature @@ -170,3 +170,24 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h """ Error: Found both a constant and a variable 'SOME_NAME' in the 'wp-custom-config.php' file. Use --type= to disambiguate. """ + + Scenario: Find variable after a concatenation assignment + Given a WP install + And a wp-config.php file: + """ + $do_redirect = 'https://example.com' . $_SERVER['REQUEST_URI']; + $table_prefix = 'wp_'; + define( 'DB_NAME', 'wp' ); + """ + + When I run `wp config has table_prefix --type=variable` + Then STDOUT should be empty + And the return code should be 0 + + When I run `wp config has DB_NAME --type=constant` + Then STDOUT should be empty + And the return code should be 0 + + When I run `wp config has do_redirect --type=variable` + Then STDOUT should be empty + And the return code should be 0 From e481a490aa6e24984bd1ce646d577fb09c9e8a00 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 10 Apr 2026 15:10:25 -0700 Subject: [PATCH 2/4] Temporarily point wp-config-transformer at dev-main for CI wp-cli/wp-config-transformer#64 is merged but not yet released. Using the VCS source + dev-main so CI can run against the fixed code. Will revert to a version constraint once a release is cut. --- composer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 16dd4cf6..c62edb00 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,15 @@ "homepage": "https://www.alainschlesser.com" } ], + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/wp-cli/wp-config-transformer" + } + ], "require": { "wp-cli/wp-cli": "^2.13", - "wp-cli/wp-config-transformer": "^1.4.0" + "wp-cli/wp-config-transformer": "dev-main" }, "require-dev": { "wp-cli/db-command": "^1.3 || ^2", From a56d6639de03ab7ddcbee78520f01e551e53196f Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 10 Apr 2026 15:17:34 -0700 Subject: [PATCH 3/4] Refactor concat scenario to Scenario Outline with Examples table Expands test coverage to mirror the edge cases in the transformer's own ConcatenationTest: concatenation expressions, variables after concatenation, multiline string values, and multiline raw expressions (array defines, multi-line concatenation). --- features/config-has.feature | 38 +++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/features/config-has.feature b/features/config-has.feature index b625e54f..d5a43c1a 100644 --- a/features/config-has.feature +++ b/features/config-has.feature @@ -171,23 +171,41 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h Error: Found both a constant and a variable 'SOME_NAME' in the 'wp-custom-config.php' file. Use --type= to disambiguate. """ - Scenario: Find variable after a concatenation assignment - Given a WP install + Scenario Outline: Find constants and variables in a config with complex expressions + Given an empty directory + And a wp-includes/version.php file: + """ + --type=` Then STDOUT should be empty And the return code should be 0 - When I run `wp config has do_redirect --type=variable` - Then STDOUT should be empty - And the return code should be 0 + Examples: + | name | type | description | + | do_redirect | variable | concatenation expression itself | + | table_prefix | variable | variable after concatenation | + | DB_NAME | constant | constant after concatenation variable | + | CUSTOM_CSS | constant | constant with multiline string value | + | after_multiline | variable | variable after multiline string value | + | long_url | variable | multiline concatenation variable | + | ALLOWED_HOSTS | constant | constant with multiline raw value | + | after_array_define | variable | variable after multiline raw define | From 1e3cf1f4631c0cf65144c882041186811fb99f5b Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 13 Apr 2026 14:58:07 +0200 Subject: [PATCH 4/4] Revert composer.json change --- composer.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/composer.json b/composer.json index c62edb00..16dd4cf6 100644 --- a/composer.json +++ b/composer.json @@ -16,15 +16,9 @@ "homepage": "https://www.alainschlesser.com" } ], - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/wp-cli/wp-config-transformer" - } - ], "require": { "wp-cli/wp-cli": "^2.13", - "wp-cli/wp-config-transformer": "dev-main" + "wp-cli/wp-config-transformer": "^1.4.0" }, "require-dev": { "wp-cli/db-command": "^1.3 || ^2",