@@ -170,3 +170,42 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h
170170 """
171171 Error: Found both a constant and a variable 'SOME_NAME' in the 'wp-custom-config.php' file. Use --type=<type> to disambiguate.
172172 """
173+
174+ Scenario Outline : Find constants and variables in a config with complex expressions
175+ Given an empty directory
176+ And a wp-includes/version.php file:
177+ """
178+ <?php $wp_version = '6.3';
179+ """
180+ And a wp-config.php file:
181+ """
182+ <?php
183+ $do_redirect = 'https://example.com' . $_SERVER['REQUEST_URI'];
184+ $table_prefix = 'wp_';
185+ define( 'DB_NAME', 'wp' );
186+ define( 'CUSTOM_CSS', 'body {
187+ color: red;
188+ }' );
189+ $after_multiline = 'found';
190+ $long_url = 'https://example.com'
191+ . '/path';
192+ define( 'ALLOWED_HOSTS', array(
193+ 'example.com',
194+ ) );
195+ $after_array_define = 'found';
196+ """
197+
198+ When I run `wp config has <name> --type=<type> `
199+ Then STDOUT should be empty
200+ And the return code should be 0
201+
202+ Examples :
203+ | name | type | description |
204+ | do_redirect | variable | concatenation expression itself |
205+ | table_prefix | variable | variable after concatenation |
206+ | DB_NAME | constant | constant after concatenation variable |
207+ | CUSTOM_CSS | constant | constant with multiline string value |
208+ | after_multiline | variable | variable after multiline string value |
209+ | long_url | variable | multiline concatenation variable |
210+ | ALLOWED_HOSTS | constant | constant with multiline raw value |
211+ | after_array_define | variable | variable after multiline raw define |
0 commit comments