1
1
Feature : Create a wp-config file
2
2
3
+ # Skipped for SQLite because `wp db create` does not yet support SQLite.
4
+ # See https://github.com/wp-cli/db-command/issues/234
5
+ # and https://github.com/wp-cli/config-command/issues/167
6
+ @require-mysql
3
7
Scenario : No wp-config.php
4
8
Given an empty directory
5
9
And WP files
@@ -24,7 +28,7 @@ Feature: Create a wp-config file
24
28
define( 'WP_DEBUG_LOG', true );
25
29
"""
26
30
27
- When I run `wp core config {CORE_CONFIG_SETTINGS} --extra-php < wp-config-extra.php`
31
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --extra-php < wp-config-extra.php`
28
32
Then the wp-config.php file should contain:
29
33
"""
30
34
'AUTH_SALT',
@@ -43,7 +47,7 @@ Feature: Create a wp-config file
43
47
define( 'WP_DEBUG_LOG', true );
44
48
"""
45
49
46
- When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
50
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
47
51
Then the wp-custom-config.php file should contain:
48
52
"""
49
53
'AUTH_SALT',
@@ -74,7 +78,7 @@ Feature: Create a wp-config file
74
78
define( 'WP_DEBUG', true );
75
79
"""
76
80
77
- When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
81
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --config-file='wp-custom-config.php' --extra-php < wp-config-extra.php`
78
82
Then the wp-custom-config.php file should contain:
79
83
"""
80
84
define( 'WP_DEBUG', true );
@@ -99,7 +103,7 @@ Feature: Create a wp-config file
99
103
define( 'WP_DEBUG_LOG', true );
100
104
"""
101
105
102
- When I run `wp core config {CORE_CONFIG_SETTINGS} --extra-php < wp-config-extra.php`
106
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --extra-php < wp-config-extra.php`
103
107
Then the wp-config.php file should not contain:
104
108
"""
105
109
define( 'WPLANG', '' );
@@ -109,7 +113,7 @@ Feature: Create a wp-config file
109
113
Given an empty directory
110
114
And WP files
111
115
112
- When I run `wp core config {CORE_CONFIG_SETTINGS} --skip-salts --extra-php < /dev/null`
116
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --skip-salts --extra-php < /dev/null`
113
117
Then the wp-config.php file should not contain:
114
118
"""
115
119
define('AUTH_SALT',
@@ -123,33 +127,45 @@ Feature: Create a wp-config file
123
127
Given an empty directory
124
128
And WP files
125
129
126
- When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=sompassword --dbprefix=""`
130
+ When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=somepassword --dbprefix=""`
127
131
Then the return code should be 1
128
132
And STDERR should contain:
129
133
"""
130
134
Error: --dbprefix cannot be empty
131
135
"""
132
136
133
- When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=sompassword --dbprefix=" "`
137
+ When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=somepassword --dbprefix=" "`
134
138
Then the return code should be 1
135
139
And STDERR should contain:
136
140
"""
137
141
Error: --dbprefix can only contain numbers, letters, and underscores.
138
142
"""
139
143
140
- When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=sompassword --dbprefix="wp-"`
144
+ When I try `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass=somepassword --dbprefix="wp-"`
141
145
Then the return code should be 1
142
146
And STDERR should contain:
143
147
"""
144
148
Error: --dbprefix can only contain numbers, letters, and underscores.
145
149
"""
146
150
151
+ @require-mysql
152
+ Scenario: Configure with invalid database credentials
153
+ Given an empty directory
154
+ And WP files
155
+
156
+ When I try `wp config create --dbname=somedb --dbuser=someuser --dbpass=somepassword`
157
+ Then the return code should be 1
158
+ And STDERR should contain:
159
+ """
160
+ Error: Database connection error
161
+ """
162
+
147
163
@require-php-7.0
148
164
Scenario: Configure with salts generated
149
165
Given an empty directory
150
166
And WP files
151
167
152
- When I run `wp core config {CORE_CONFIG_SETTINGS}`
168
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check `
153
169
Then the wp-config.php file should contain:
154
170
"""
155
171
define( 'AUTH_SALT',
@@ -160,7 +176,7 @@ Feature: Create a wp-config file
160
176
Given an empty directory
161
177
And WP files
162
178
163
- When I run `wp core config {CORE_CONFIG_SETTINGS}`
179
+ When I run `wp config create {CORE_CONFIG_SETTINGS}`
164
180
Then the wp-config.php file should contain:
165
181
"""
166
182
define( 'AUTH_SALT',
@@ -170,20 +186,20 @@ Feature: Create a wp-config file
170
186
Given an empty directory
171
187
And I run `wp core download --version=3.9 --force`
172
188
173
- When I run `wp core config {CORE_CONFIG_SETTINGS}`
189
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check `
174
190
Then the wp-config.php file should contain:
175
191
"""
176
192
define( 'WPLANG', '' );
177
193
"""
178
194
179
- When I try `wp core config {CORE_CONFIG_SETTINGS}`
195
+ When I try `wp config create {CORE_CONFIG_SETTINGS}`
180
196
Then the return code should be 1
181
197
And STDERR should contain:
182
198
"""
183
199
Error: The 'wp-config.php' file already exists.
184
200
"""
185
201
186
- When I run `wp core config {CORE_CONFIG_SETTINGS} --locale=ja --force`
202
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --locale=ja --force`
187
203
Then the return code should be 0
188
204
And STDOUT should contain:
189
205
"""
@@ -194,7 +210,7 @@ Feature: Create a wp-config file
194
210
define( 'WPLANG', 'ja' );
195
211
"""
196
212
197
- When I run `wp core config {CORE_CONFIG_SETTINGS} --config-file=wp-custom-config.php --locale=ja --force`
213
+ When I run `wp config create {CORE_CONFIG_SETTINGS} --skip-check --config-file=wp-custom-config.php --locale=ja --force`
198
214
Then the return code should be 0
199
215
And STDOUT should contain:
200
216
"""
0 commit comments