@@ -6,22 +6,27 @@ Feature: List database tables
6
6
When I run `wp db tables`
7
7
Then STDOUT should contain:
8
8
"""
9
- wp_users
10
- wp_usermeta
11
- wp_posts
9
+ wp_commentmeta
12
10
wp_comments
13
11
wp_links
14
12
wp_options
15
13
wp_postmeta
16
- wp_terms
17
- wp_term_taxonomy
14
+ wp_posts
18
15
wp_term_relationships
16
+ wp_term_taxonomy
17
+ """
18
+ # Leave out wp_termmeta for old WP compat.
19
+ And STDOUT should contain:
20
+ """
21
+ wp_terms
22
+ wp_usermeta
23
+ wp_users
19
24
"""
20
25
21
26
When I run `wp db tables --format=csv`
22
27
Then STDOUT should contain:
23
28
"""
24
- wp_users, wp_usermeta,wp_posts,wp_comments,
29
+ ,wp_terms, wp_usermeta,wp_users
25
30
"""
26
31
27
32
When I run `wp db tables 'wp_post*' --format=csv`
@@ -37,33 +42,41 @@ Feature: List database tables
37
42
When I run `wp db tables`
38
43
Then STDOUT should contain:
39
44
"""
40
- wp_users
41
- wp_usermeta
42
- wp_posts
45
+ wp_blog_versions
46
+ wp_blogs
47
+ wp_commentmeta
43
48
wp_comments
44
49
wp_links
45
50
wp_options
46
51
wp_postmeta
47
- wp_terms
48
- wp_term_taxonomy
52
+ wp_posts
53
+ wp_registration_log
54
+ wp_signups
55
+ wp_site
56
+ wp_sitemeta
49
57
wp_term_relationships
58
+ wp_term_taxonomy
50
59
"""
60
+ # Leave out wp_termmeta for old WP compat.
51
61
And STDOUT should contain:
52
62
"""
53
- wp_blogs
54
- wp_signups
55
- wp_site
56
- wp_sitemeta
57
- wp_registration_log
58
- wp_blog_versions
63
+ wp_terms
64
+ wp_usermeta
65
+ wp_users
59
66
"""
60
67
61
68
When I run `wp site create --slug=foo`
62
69
And I run `wp db tables --url=example.com/foo`
63
70
Then STDOUT should contain:
64
71
"""
65
72
wp_users
73
+ """
74
+ And STDOUT should contain:
75
+ """
66
76
wp_usermeta
77
+ """
78
+ And STDOUT should contain:
79
+ """
67
80
wp_2_posts
68
81
"""
69
82
@@ -130,3 +143,108 @@ Feature: List database tables
130
143
"""
131
144
wp_21_posts
132
145
"""
146
+
147
+ Scenario : List database tables with wildcards on a single WordPress install with custom table prefix
148
+ Given a WP install
149
+ And "$table_prefix = 'wp_';" replaced with "$table_prefix = 'as_wp_';" in the wp-config.php file
150
+ And I try `wp core install --url=example.com --title=example --admin_user=wpcli --admin_email=wpcli@example.com`
151
+ Then STDOUT should contain:
152
+ """
153
+ Success:
154
+ """
155
+ And the return code should be 0
156
+
157
+ When I run `wp db tables '*_posts' `
158
+ Then STDOUT should be:
159
+ """
160
+ as_wp_posts
161
+ """
162
+
163
+ When I run `wp db tables '*_posts' --network`
164
+ Then STDOUT should be:
165
+ """
166
+ as_wp_posts
167
+ """
168
+
169
+ When I run `wp db tables '*_posts' --scope=blog`
170
+ Then STDOUT should be:
171
+ """
172
+ as_wp_posts
173
+ """
174
+
175
+ When I try `wp db tables '*_posts' --scope=global`
176
+ Then STDERR should not be empty
177
+ And STDOUT should be empty
178
+ And the return code should be 1
179
+
180
+ When I run `wp db tables '*_users' --scope=global`
181
+ Then STDOUT should be:
182
+ """
183
+ as_wp_users
184
+ """
185
+
186
+ Scenario : List database tables with wildcards on a multisite WordPress install with custom table prefix
187
+ Given a WP multisite install
188
+ And "$table_prefix = 'wp_';" replaced with "$table_prefix = 'as_wp_';" in the wp-config.php file
189
+ # Use try to cater for wp-db errors in old WPs.
190
+ And I try `wp core multisite-install --url=example.com --title=example --admin_user=wpcli --admin_email=wpcli@example.com`
191
+ Then STDOUT should contain:
192
+ """
193
+ Success:
194
+ """
195
+ And the return code should be 0
196
+ And I run `wp site create --slug=foo`
197
+
198
+ When I run `wp db tables '*_posts' `
199
+ Then STDOUT should be:
200
+ """
201
+ as_wp_posts
202
+ """
203
+
204
+ When I run `wp db tables '*_posts' --url=example.com/foo`
205
+ Then STDOUT should be:
206
+ """
207
+ as_wp_2_posts
208
+ """
209
+
210
+ When I run `wp db tables '*_posts' --network`
211
+ Then STDOUT should be:
212
+ """
213
+ as_wp_2_posts
214
+ as_wp_posts
215
+ """
216
+
217
+ When I run `wp db tables '*_posts' --scope=blog`
218
+ Then STDOUT should be:
219
+ """
220
+ as_wp_posts
221
+ """
222
+
223
+ When I run `wp db tables '*_posts' --scope=blog --network`
224
+ Then STDOUT should be:
225
+ """
226
+ as_wp_2_posts
227
+ as_wp_posts
228
+ """
229
+
230
+ When I try `wp db tables '*_posts' --scope=global`
231
+ Then STDERR should not be empty
232
+ And STDOUT should be empty
233
+ And the return code should be 1
234
+
235
+ When I try `wp db tables '*_posts' --scope=global --network`
236
+ Then STDERR should not be empty
237
+ And STDOUT should be empty
238
+ And the return code should be 1
239
+
240
+ When I run `wp db tables '*_users' --scope=global`
241
+ Then STDOUT should be:
242
+ """
243
+ as_wp_users
244
+ """
245
+
246
+ When I run `wp db tables '*_users' --scope=global --network`
247
+ Then STDOUT should be:
248
+ """
249
+ as_wp_users
250
+ """
0 commit comments