Skip to content

Commit a56d663

Browse files
committed
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).
1 parent ffce963 commit a56d663

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

features/config-has.feature

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,41 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h
171171
Error: Found both a constant and a variable 'SOME_NAME' in the 'wp-custom-config.php' file. Use --type=<type> to disambiguate.
172172
"""
173173

174-
Scenario: Find variable after a concatenation assignment
175-
Given a WP install
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+
"""
176180
And a wp-config.php file:
177181
"""
182+
<?php
178183
$do_redirect = 'https://example.com' . $_SERVER['REQUEST_URI'];
179184
$table_prefix = 'wp_';
180185
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';
181196
"""
182197

183-
When I run `wp config has table_prefix --type=variable`
184-
Then STDOUT should be empty
185-
And the return code should be 0
186-
187-
When I run `wp config has DB_NAME --type=constant`
198+
When I run `wp config has <name> --type=<type>`
188199
Then STDOUT should be empty
189200
And the return code should be 0
190201

191-
When I run `wp config has do_redirect --type=variable`
192-
Then STDOUT should be empty
193-
And the return code should be 0
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

Comments
 (0)