Skip to content

Commit 4610843

Browse files
Fix db connection error tests for WP >= 5.2
WP 5.2 only emits these extended strings when `WP_DEBUG=true`
1 parent e4a9f0f commit 4610843

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

features/db.feature

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@ Feature: Perform database operations
1212
"""
1313
y
1414
"""
15+
And wp-debug.php file:
16+
"""
17+
<?php
18+
define( 'WP_DEBUG', true );
19+
"""
20+
And a wp-cli.yml file:
21+
"""
22+
require:
23+
- wp-debug.php
24+
"""
1525

1626
When I try `wp option get home`
1727
Then STDOUT should be empty
18-
And STDERR should be:
28+
And STDERR should contain:
1929
"""
20-
Error: Can’t select database. We were able to connect to the database server (which means your username and password is okay) but not able to select the `wp_cli_test` database.
30+
Can’t select database. We were able to connect to the database server (which means your username and password is okay) but not able to select the `wp_cli_test` database.
2131
"""
2232

2333
When I run `wp db create`
@@ -54,12 +64,22 @@ Feature: Perform database operations
5464
Given an empty directory
5565
And WP files
5666
And wp-config.php
67+
And wp-debug.php file:
68+
"""
69+
<?php
70+
define( 'WP_DEBUG', true );
71+
"""
72+
And a wp-cli.yml file:
73+
"""
74+
require:
75+
- wp-debug.php
76+
"""
5777
5878
When I try `wp option get home`
5979
Then STDOUT should be empty
6080
And STDERR should be:
6181
"""
62-
Error: Can’t select database. We were able to connect to the database server (which means your username and password is okay) but not able to select the `wp_cli_test` database.
82+
Can’t select database. We were able to connect to the database server (which means your username and password is okay) but not able to select the `wp_cli_test` database.
6383
"""
6484
6585
When I run `wp db create --dbuser=wp_cli_test`

0 commit comments

Comments
 (0)