File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1134,12 +1134,19 @@ public function test_connection(): void {
11341134 'send_to_shell ' => false ,
11351135 ]
11361136 );
1137- if ( ! empty ( $ sql_result ['stderr ' ] ) ) {
1137+
1138+ if ( $ sql_result ['exit_code ' ] !== 0 ) {
11381139 # WP_CLI output functions are suppressed in behat context.
11391140 echo 'There was an error connecting to the database: ' . \PHP_EOL ;
1140- echo ' ' . trim ( $ sql_result ['stderr ' ] ) . \PHP_EOL ;
1141+ if ( ! empty ( $ sql_result ['stderr ' ] ) ) {
1142+ echo ' ' . trim ( $ sql_result ['stderr ' ] ) . \PHP_EOL ;
1143+ }
11411144 echo 'run `composer prepare-tests` to connect to the database. ' . \PHP_EOL ;
1142- die ( 1 );
1145+ die ( $ sql_result ['exit_code ' ] );
1146+ } elseif ( ! empty ( $ sql_result ['stderr ' ] ) ) {
1147+ // There is "error" output but not an exit code.
1148+ // Probably a warning, still display it.
1149+ echo trim ( $ sql_result ['stderr ' ] ) . \PHP_EOL ;
11431150 }
11441151 }
11451152
You can’t perform that action at this time.
0 commit comments