@@ -6,22 +6,27 @@ Feature: List database tables
66 When I run `wp db tables`
77 Then STDOUT should contain:
88 """
9- wp_users
10- wp_usermeta
11- wp_posts
9+ wp_commentmeta
1210 wp_comments
1311 wp_links
1412 wp_options
1513 wp_postmeta
16- wp_terms
17- wp_term_taxonomy
14+ wp_posts
1815 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
1924 """
2025
2126 When I run `wp db tables --format=csv`
2227 Then STDOUT should contain:
2328 """
24- wp_users, wp_usermeta,wp_posts,wp_comments,
29+ ,wp_terms, wp_usermeta,wp_users
2530 """
2631
2732 When I run `wp db tables 'wp_post*' --format=csv`
@@ -37,33 +42,41 @@ Feature: List database tables
3742 When I run `wp db tables`
3843 Then STDOUT should contain:
3944 """
40- wp_users
41- wp_usermeta
42- wp_posts
45+ wp_blog_versions
46+ wp_blogs
47+ wp_commentmeta
4348 wp_comments
4449 wp_links
4550 wp_options
4651 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
4957 wp_term_relationships
58+ wp_term_taxonomy
5059 """
60+ # Leave out wp_termmeta for old WP compat.
5161 And STDOUT should contain:
5262 """
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
5966 """
6067
6168 When I run `wp site create --slug=foo`
6269 And I run `wp db tables --url=example.com/foo`
6370 Then STDOUT should contain:
6471 """
6572 wp_users
73+ """
74+ And STDOUT should contain:
75+ """
6676 wp_usermeta
77+ """
78+ And STDOUT should contain:
79+ """
6780 wp_2_posts
6881 """
6982
@@ -130,3 +143,108 @@ Feature: List database tables
130143 """
131144 wp_21_posts
132145 """
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