File tree Expand file tree Collapse file tree 4 files changed +75
-0
lines changed Expand file tree Collapse file tree 4 files changed +75
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,19 @@ Feature: Check the database
26
26
Success: Database checked.
27
27
"""
28
28
29
+ Scenario : Run db check with --no-defaults to check the database
30
+ Given a WP install
31
+
32
+ When I run `wp db check --no-defaults`
33
+ Then STDOUT should contain:
34
+ """
35
+ wp_cli_test.wp_users
36
+ """
37
+ And STDOUT should contain:
38
+ """
39
+ Success: Database checked.
40
+ """
41
+
29
42
Scenario : Run db check with passed-in options
30
43
Given a WP install
31
44
@@ -125,3 +138,9 @@ Feature: Check the database
125
138
"""
126
139
Debug (db): Running shell command: /usr/bin/env mysqlcheck --no-defaults %s
127
140
"""
141
+
142
+ When I try `wp db check --no-defaults --debug`
143
+ Then STDERR should contain:
144
+ """
145
+ Debug (db): Running shell command: /usr/bin/env mysqlcheck --no-defaults %s
146
+ """
Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ Feature: Export a WordPress database
52
52
-- MySQL dump
53
53
"""
54
54
55
+ Scenario : Export database with mysql --no-defaults to STDOUT
56
+ Given a WP install
57
+
58
+ When I run `wp db export --no-defaults -`
59
+ Then STDOUT should contain:
60
+ """
61
+ -- MySQL dump
62
+ """
63
+
55
64
Scenario : Export database with passed-in options
56
65
Given a WP install
57
66
@@ -83,3 +92,9 @@ Feature: Export a WordPress database
83
92
"""
84
93
Debug (db): Running initial shell command: /usr/bin/env mysqldump --no-defaults
85
94
"""
95
+
96
+ When I try `wp db export --no-defaults --debug`
97
+ Then STDERR should contain:
98
+ """
99
+ Debug (db): Running initial shell command: /usr/bin/env mysqldump --no-defaults
100
+ """
Original file line number Diff line number Diff line change @@ -24,6 +24,18 @@ Feature: Import a WordPress database
24
24
Success: Imported from 'wp_cli_test.sql'.
25
25
"""
26
26
27
+ Scenario : Import from database name path by default with --no-defaults
28
+ Given a WP install
29
+
30
+ When I run `wp db export wp_cli_test.sql`
31
+ Then the wp_cli_test.sql file should exist
32
+
33
+ When I run `wp db import --no-defaults`
34
+ Then STDOUT should be:
35
+ """
36
+ Success: Imported from 'wp_cli_test.sql'.
37
+ """
38
+
27
39
Scenario : Import from STDIN
28
40
Given a WP install
29
41
@@ -133,3 +145,9 @@ Feature: Import a WordPress database
133
145
"""
134
146
Debug (db): Running shell command: /usr/bin/env mysql --no-defaults --no-auto-rehash
135
147
"""
148
+
149
+ When I try `wp db import --no-defaults --debug`
150
+ Then STDERR should contain:
151
+ """
152
+ Debug (db): Running shell command: /usr/bin/env mysql --no-defaults --no-auto-rehash
153
+ """
Original file line number Diff line number Diff line change @@ -55,6 +55,23 @@ Feature: Query the database with WordPress' MySQL config
55
55
"""
56
56
And STDOUT should be empty
57
57
58
+ Scenario : Database querying with --nodefaults and passed-in options
59
+ Given a WP install
60
+
61
+ When I run `wp db query --no-defaults "SELECT COUNT(ID) FROM wp_posts;" --dbuser=wp_cli_test --html`
62
+ Then STDOUT should contain:
63
+ """
64
+ <TABLE
65
+ """
66
+
67
+ When I try `wp db query --no-defaults "SELECT COUNT(ID) FROM wp_posts;" --dbuser=no_such_user`
68
+ Then the return code should not be 0
69
+ And STDERR should contain:
70
+ """
71
+ Access denied
72
+ """
73
+ And STDOUT should be empty
74
+
58
75
Scenario : MySQL defaults are available as appropriate with --defaults flag
59
76
Given a WP install
60
77
@@ -69,3 +86,9 @@ Feature: Query the database with WordPress' MySQL config
69
86
"""
70
87
Debug (db): Running shell command: /usr/bin/env mysql --no-defaults --no-auto-rehash
71
88
"""
89
+
90
+ When I try `wp db query --no-defaults --debug`
91
+ Then STDERR should contain:
92
+ """
93
+ Debug (db): Running shell command: /usr/bin/env mysql --no-defaults --no-auto-rehash
94
+ """
You can’t perform that action at this time.
0 commit comments