Skip to content

Commit 2d3805b

Browse files
committed
Add DB root user & pass to Behat vars
1 parent 7a6a9de commit 2d3805b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Context/FeatureContext.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,14 @@ public static function create_cache_dir() {
482482
* Every scenario gets its own context object.
483483
*/
484484
public function __construct() {
485+
if ( getenv( 'WP_CLI_TEST_DBROOTUSER' ) ) {
486+
self::$db_settings['dbrootuser'] = getenv( 'WP_CLI_TEST_DBROOTUSER' );
487+
}
488+
489+
if ( false !== getenv( 'WP_CLI_TEST_DBROOTPASS' ) ) {
490+
self::$db_settings['dbrootpass'] = getenv( 'WP_CLI_TEST_DBROOTPASS' );
491+
}
492+
485493
if ( getenv( 'WP_CLI_TEST_DBUSER' ) ) {
486494
self::$db_settings['dbuser'] = getenv( 'WP_CLI_TEST_DBUSER' );
487495
}
@@ -496,6 +504,8 @@ public function __construct() {
496504

497505
$this->drop_db();
498506
$this->set_cache_dir();
507+
$this->variables['DB_ROOT_USER'] = self::$db_settings['dbrootuser'];
508+
$this->variables['DB_ROOT_PASSWORD'] = self::$db_settings['dbrootpass'];
499509
$this->variables['DB_USER'] = self::$db_settings['dbuser'];
500510
$this->variables['DB_PASSWORD'] = self::$db_settings['dbpass'];
501511
$this->variables['DB_HOST'] = self::$db_settings['dbhost'];

0 commit comments

Comments
 (0)