Skip to content

Commit aa37c9b

Browse files
authored
Improve tests involving an object cache (#324)
1 parent b62ae81 commit aa37c9b

File tree

2 files changed

+58
-22
lines changed

2 files changed

+58
-22
lines changed

features/core-install.feature

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ Feature: Install WordPress core
4545
Success: Generated 'wp-config.php' file.
4646
"""
4747
48-
When I run `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=newpassword`
48+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
49+
When I try `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=newpassword`
4950
Then STDOUT should contain:
5051
"""
5152
Success: WordPress installed successfully.
5253
"""
54+
And the return code should be 0
5355
5456
When I run `wp user list --field=user_login`
5557
Then STDOUT should be:
@@ -119,11 +121,13 @@ Feature: Install WordPress core
119121
Success: Generated 'wp-config.php' file.
120122
"""
121123
122-
When I run `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=newpassword`
124+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
125+
When I try `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=newpassword`
123126
Then STDOUT should contain:
124127
"""
125128
Success: WordPress installed successfully.
126129
"""
130+
And the return code should be 0
127131
128132
When I run `wp user list --field=user_login`
129133
Then STDOUT should be:
@@ -165,7 +169,7 @@ Feature: Install WordPress core
165169
And wp-config.php
166170
And a database
167171
168-
# Old versions of WP can generate wpdb database errors if the WP tables don't exist, so STDERR may or may not be empty
172+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
169173
When I try `wp core install --url=localhost:8001 --title=Test --admin_user=wpcli --admin_email=wpcli@example.org`
170174
Then STDOUT should contain:
171175
"""
@@ -183,11 +187,13 @@ Feature: Install WordPress core
183187
And wp-config.php
184188
And a database
185189
186-
When I run `wp core install --url=example.com --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
190+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
191+
When I try `wp core install --url=example.com --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
187192
Then STDOUT should contain:
188193
"""
189194
Success: WordPress installed successfully.
190195
"""
196+
And the return code should be 0
191197
192198
When I run `wp option get home`
193199
Then STDOUT should be:
@@ -207,11 +213,13 @@ Feature: Install WordPress core
207213
And wp-config.php
208214
And a database
209215
210-
When I run `wp core install --url=example.com/subdir --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
216+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
217+
When I try `wp core install --url=example.com/subdir --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
211218
Then STDOUT should contain:
212219
"""
213220
Success: WordPress installed successfully.
214221
"""
222+
And the return code should be 0
215223
216224
When I run `wp option get home`
217225
Then STDOUT should be:
@@ -231,11 +239,13 @@ Feature: Install WordPress core
231239
And wp-config.php
232240
And a database
233241
234-
When I run `wp core install --url=https://example.com --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
242+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
243+
When I try `wp core install --url=https://example.com --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
235244
Then STDOUT should contain:
236245
"""
237246
Success: WordPress installed successfully.
238247
"""
248+
And the return code should be 0
239249
240250
When I run `wp option get home`
241251
Then STDOUT should be:
@@ -255,7 +265,8 @@ Feature: Install WordPress core
255265
And wp-config.php
256266
And a database
257267
258-
When I run `wp core install --url=localhost:8001 --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password='R^^CzY;G"iZ@]H9b,' --skip-email`
268+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
269+
When I try `wp core install --url=localhost:8001 --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password='R^^CzY;G"iZ@]H9b,' --skip-email`
259270
Then STDOUT should contain:
260271
"""
261272
Success: WordPress installed successfully.
@@ -288,12 +299,13 @@ Feature: Install WordPress core
288299
Success: Generated 'wp-config.php' file.
289300
"""
290301

291-
# Old versions of WP can generate wpdb database errors if the WP tables don't exist, so STDERR may or may not be empty
292-
When I run `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=newpassword --locale=de_DE --skip-email`
302+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
303+
When I try `wp core install --url=example.org --title=Test --admin_user=testadmin --admin_email=testadmin@example.com --admin_password=newpassword --locale=de_DE --skip-email`
293304
Then STDOUT should contain:
294305
"""
295306
Success: WordPress installed successfully.
296307
"""
308+
And the return code should be 0
297309

298310
When I run `wp core version`
299311
Then STDOUT should contain:
@@ -313,7 +325,7 @@ Feature: Install WordPress core
313325
And wp-config.php
314326
And a database
315327

316-
# Old versions of WP can generate wpdb database errors if the WP tables don't exist, so STDERR may or may not be empty
328+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
317329
When I try `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com`
318330
Then STDOUT should contain:
319331
"""
@@ -331,11 +343,13 @@ Feature: Install WordPress core
331343
And wp-config.php
332344
And a database
333345

334-
When I run `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=password --skip-config`
346+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
347+
When I try `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=password --skip-config`
335348
Then STDOUT should contain:
336349
"""
337350
Addition of multisite constants to 'wp-config.php' skipped. You need to add them manually:
338351
"""
352+
And the return code should be 0
339353

340354
@require-mysql
341355
Scenario: Install WordPress multisite with existing multisite constants in wp-config file
@@ -360,13 +374,15 @@ Feature: Install WordPress core
360374
Success: Generated 'wp-config.php' file.
361375
"""
362376
363-
When I run `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=password --skip-config`
377+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
378+
When I try `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=password --skip-config`
364379
Then STDOUT should be:
365380
"""
366381
Created single site database tables.
367382
Set up multisite database tables.
368383
Success: Network installed. Don't forget to set up rewrite rules (and a .htaccess file, if using Apache).
369384
"""
385+
And the return code should be 0
370386
371387
When I run `wp db query "select * from wp_sitemeta where meta_key = 'site_admins' and meta_value = ''"`
372388
Then STDOUT should be:

features/core.feature

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ Feature: Manage WordPress installation
2727
When I try `wp core is-installed --network`
2828
Then the return code should be 1
2929

30+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
3031
When I try `wp core install`
3132
Then the return code should be 1
3233
And STDERR should contain:
3334
"""
3435
missing --url parameter (The address of the new site.)
3536
"""
3637

37-
When I run `wp core install --url='localhost:8001' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
38+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
39+
When I try `wp core install --url='localhost:8001' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
3840
Then STDOUT should not be empty
41+
And the return code should be 0
3942

4043
When I run `wp eval 'echo home_url();'`
4144
Then STDOUT should be:
@@ -60,8 +63,10 @@ Feature: Manage WordPress installation
6063
admin@example.com
6164
"""
6265

63-
When I run `wp core install --prompt < session`
66+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
67+
When I try `wp core install --prompt < session`
6468
Then STDOUT should not be empty
69+
And the return code should be 0
6570
6671
When I run `wp eval 'echo home_url();'`
6772
Then STDOUT should be:
@@ -80,8 +85,10 @@ Feature: Manage WordPress installation
8085
admin@example.com
8186
"""
8287
83-
When I run `wp core install --url=localhost:8001 --title=Test --admin_user=wpcli --prompt=admin_password,admin_email < session`
88+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
89+
When I try `wp core install --url=localhost:8001 --title=Test --admin_user=wpcli --prompt=admin_password,admin_email < session`
8490
Then STDOUT should not be empty
91+
And the return code should be 0
8592
8693
When I run `wp eval 'echo home_url();'`
8794
Then STDOUT should be:
@@ -95,7 +102,8 @@ Feature: Manage WordPress installation
95102
And wp-config.php
96103
And a database
97104
98-
When I run `wp core install --url='https://localhost' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
105+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
106+
When I try `wp core install --url='https://localhost' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
99107
Then the return code should be 0
100108
101109
When I run `wp eval 'echo home_url();'`
@@ -110,7 +118,8 @@ Feature: Manage WordPress installation
110118
And wp-config.php
111119
And a database
112120
113-
When I run `wp core install --url='https://localhost:8443' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
121+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
122+
When I try `wp core install --url='https://localhost:8443' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
114123
Then the return code should be 0
115124
116125
When I run `wp eval 'echo home_url();'`
@@ -139,6 +148,7 @@ Feature: Manage WordPress installation
139148
"""
140149
141150
# Can complain that it's already installed, but don't exit with an error code
151+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
142152
When I try `wp core install --url='localhost:8001' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
143153
Then the return code should be 0
144154
@@ -172,6 +182,7 @@ Feature: Manage WordPress installation
172182
When I run `wp core is-installed --network`
173183
Then the return code should be 0
174184
185+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
175186
When I try `wp core install-network --title='test network'`
176187
Then the return code should be 1
177188
@@ -187,15 +198,16 @@ Feature: Manage WordPress installation
187198
And wp-config.php
188199
And a database
189200
190-
When I run `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
201+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
202+
When I try `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
191203
Then STDOUT should be:
192204
"""
193205
Created single site database tables.
194206
Set up multisite database tables.
195207
Added multisite constants to 'wp-config.php'.
196208
Success: Network installed. Don't forget to set up rewrite rules (and a .htaccess file, if using Apache).
197209
"""
198-
And STDERR should be empty
210+
And the return code should be 0
199211
200212
When I run `wp eval 'echo $GLOBALS["current_site"]->domain;'`
201213
Then STDOUT should be:
@@ -204,6 +216,7 @@ Feature: Manage WordPress installation
204216
"""
205217
206218
# Can complain that it's already installed, but don't exit with an error code
219+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
207220
When I try `wp core multisite-install --url=foobar.org --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
208221
Then the return code should be 0
209222
@@ -228,8 +241,10 @@ Feature: Manage WordPress installation
228241
WordPress database error Table
229242
"""
230243
231-
When I run `wp core multisite-install --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
244+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
245+
When I try `wp core multisite-install --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
232246
Then STDOUT should not be empty
247+
And the return code should be 0
233248
234249
When I run `wp eval 'echo $GLOBALS["current_site"]->domain;'`
235250
Then STDOUT should be:
@@ -243,6 +258,7 @@ Feature: Manage WordPress installation
243258
And wp-config.php
244259
And a database
245260

261+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
246262
When I try `wp core multisite-install --url=http://localhost/ --title=Test --admin_user=wpcli --admin_email=admin@example.com --admin_password=1 --subdomains`
247263
Then STDERR should contain:
248264
"""
@@ -269,8 +285,10 @@ Feature: Manage WordPress installation
269285
user: wpcli
270286
"""
271287

272-
When I run `wp core install --url='localhost:8001' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
288+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
289+
When I try `wp core install --url='localhost:8001' --title='Test' --admin_user=wpcli --admin_email=admin@example.com --admin_password=1`
273290
Then STDOUT should not be empty
291+
And the return code should be 0
274292

275293
When I run `wp eval 'echo home_url();'`
276294
Then STDOUT should be:
@@ -358,11 +376,13 @@ Feature: Manage WordPress installation
358376

359377
When I run `wp db create`
360378
# extra/no-mail.php not present as mu-plugin so skip sending email else will fail on Travis with "sh: 1: -t: not found"
361-
And I run `wp core install --url=example.com --title="WP Example" --admin_user=wpcli --admin_password=wpcli --admin_email=wpcli@example.com --skip-email`
379+
# The SQLite object cache drop-in might produce a "no such table: wp_options" STDERR during installation.
380+
And I try `wp core install --url=example.com --title="WP Example" --admin_user=wpcli --admin_password=wpcli --admin_email=wpcli@example.com --skip-email`
362381
Then STDOUT should contain:
363382
"""
364383
Success: WordPress installed successfully.
365384
"""
385+
And the return code should be 0
366386

367387
When I run `wp option get home`
368388
Then STDOUT should be:

0 commit comments

Comments
 (0)