From a9ff10aec78636859d46fb0b940158a943ef5a6b Mon Sep 17 00:00:00 2001 From: Lewis Cowles Date: Wed, 10 Mar 2021 20:42:02 +0000 Subject: [PATCH 1/2] add MYSQL_HOST and MYSQL_TCP_PORT --- src/Context/FeatureContext.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Context/FeatureContext.php b/src/Context/FeatureContext.php index 15e2d446..8fe199fb 100644 --- a/src/Context/FeatureContext.php +++ b/src/Context/FeatureContext.php @@ -498,10 +498,22 @@ public function __construct() { $this->variables['DB_PASSWORD'] = getenv( 'WP_CLI_TEST_DBPASS' ); } + if ( false !== getenv( 'WP_CLI_TEST_DBPASS' ) ) { + $this->variables['DB_PASSWORD'] = getenv( 'WP_CLI_TEST_DBPASS' ); + } + if ( getenv( 'WP_CLI_TEST_DBHOST' ) ) { $this->variables['DB_HOST'] = getenv( 'WP_CLI_TEST_DBHOST' ); } + if ( getenv( 'MYSQL_TCP_PORT' ) ) { + $this->variables['MYSQL_PORT'] = getenv( 'MYSQL_TCP_PORT' ); + } + + if ( getenv( 'MYSQL_HOST' ) ) { + $this->variables['MYSQL_HOST'] = getenv( 'MYSQL_HOST' ); + } + self::$db_settings['dbuser'] = $this->variables['DB_USER']; self::$db_settings['dbpass'] = $this->variables['DB_PASSWORD']; self::$db_settings['dbhost'] = $this->variables['DB_HOST']; From 177a1b00f79970a2dd748359418ec54f800e68c7 Mon Sep 17 00:00:00 2001 From: Lewis Cowles Date: Wed, 10 Mar 2021 20:45:20 +0000 Subject: [PATCH 2/2] Remove accidental duplicate Committed in error. --- src/Context/FeatureContext.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Context/FeatureContext.php b/src/Context/FeatureContext.php index 8fe199fb..1c1baf0d 100644 --- a/src/Context/FeatureContext.php +++ b/src/Context/FeatureContext.php @@ -498,10 +498,6 @@ public function __construct() { $this->variables['DB_PASSWORD'] = getenv( 'WP_CLI_TEST_DBPASS' ); } - if ( false !== getenv( 'WP_CLI_TEST_DBPASS' ) ) { - $this->variables['DB_PASSWORD'] = getenv( 'WP_CLI_TEST_DBPASS' ); - } - if ( getenv( 'WP_CLI_TEST_DBHOST' ) ) { $this->variables['DB_HOST'] = getenv( 'WP_CLI_TEST_DBHOST' ); }