@@ -678,3 +678,58 @@ Feature: Have a config file
678678 """
679679 Error: Strange wp-config.php file: wp-settings.php is not loaded directly.
680680 """
681+
682+ Scenario : Code after wp-settings.php call should be loaded
683+ Given a WP installation
684+ And a wp-config.php file:
685+ """
686+ <?php
687+ if ( 1 === 1 ) {
688+ require_once ABSPATH . 'some-other-file.php';
689+ }
690+
691+ define('DB_NAME', '{DB_NAME}');
692+ define('DB_USER', '{DB_USER}');
693+ define('DB_PASSWORD', '{DB_PASSWORD}');
694+ define('DB_HOST', '{DB_HOST}');
695+ define('DB_CHARSET', 'utf8');
696+ define('DB_COLLATE', '');
697+ $table_prefix = 'wp_';
698+
699+ /* That's all, stop editing! Happy publishing. */
700+
701+ /** Sets up WordPress vars and included files. */
702+ require_once
703+ ABSPATH . 'wp-settings.php'
704+ ;
705+
706+ require_once ABSPATH . 'includes-file.php';
707+ """
708+ And a includes-file.php file:
709+ """
710+ <?php
711+ define( 'MY_CONSTANT', true );
712+ """
713+ And a some-other-file.php file:
714+ """
715+ <?php
716+ define( 'MY_OTHER_CONSTANT', true );
717+ """
718+
719+ When I try `wp core is-installed`
720+ Then STDERR should not contain:
721+ """
722+ Error: Strange wp-config.php file: wp-settings.php is not loaded directly.
723+ """
724+
725+ When I run `wp eval 'var_export( defined("MY_CONSTANT") );' `
726+ Then STDOUT should be:
727+ """
728+ true
729+ """
730+
731+ When I run `wp eval 'var_export( defined("MY_OTHER_CONSTANT") );' `
732+ Then STDOUT should be:
733+ """
734+ true
735+ """
0 commit comments