File tree Expand file tree Collapse file tree 4 files changed +62
-11
lines changed Expand file tree Collapse file tree 4 files changed +62
-11
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,19 @@ Feature: Check the database
13
13
Success: Database checked.
14
14
"""
15
15
16
+ Scenario : Run db check with MySQL defaults to check the database
17
+ Given a WP install
18
+
19
+ When I run `wp db check --defaults`
20
+ Then STDOUT should contain:
21
+ """
22
+ wp_cli_test.wp_users
23
+ """
24
+ And STDOUT should contain:
25
+ """
26
+ Success: Database checked.
27
+ """
28
+
16
29
Scenario : Run db check with passed-in options
17
30
Given a WP install
18
31
@@ -104,11 +117,11 @@ Feature: Check the database
104
117
When I try `wp db check --defaults --debug`
105
118
Then STDERR should contain:
106
119
"""
107
- Debug (db): /usr/bin/env mysqlcheck %s
120
+ Debug (db): Running shell command: /usr/bin/env mysqlcheck %s
108
121
"""
109
122
110
123
When I try `wp db check --debug`
111
124
Then STDERR should contain:
112
125
"""
113
- Debug (db): /usr/bin/env mysqlcheck --no-defaults %s
126
+ Debug (db): Running shell command: /usr/bin/env mysqlcheck --no-defaults %s
114
127
"""
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ Feature: Export a WordPress database
43
43
-- MySQL dump
44
44
"""
45
45
46
+ Scenario : Export database with mysql defaults to STDOUT
47
+ Given a WP install
48
+
49
+ When I run `wp db export --defaults -`
50
+ Then STDOUT should contain:
51
+ """
52
+ -- MySQL dump
53
+ """
54
+
46
55
Scenario : Export database with passed-in options
47
56
Given a WP install
48
57
@@ -60,17 +69,17 @@ Feature: Export a WordPress database
60
69
"""
61
70
And STDOUT should be empty
62
71
63
- Scenario : Ensure MySQL defaults are available when as appropriate with --defaults flag
72
+ Scenario : MySQL defaults are available as appropriate with --defaults flag
64
73
Given a WP install
65
74
66
75
When I try `wp db export --defaults --debug`
67
76
Then STDERR should contain:
68
77
"""
69
- Debug (db): /usr/bin/env mysqldump
78
+ Debug (db): Running initial shell command: /usr/bin/env mysqldump
70
79
"""
71
80
72
81
When I try `wp db export --debug`
73
82
Then STDERR should contain:
74
83
"""
75
- Debug (db): /usr/bin/env mysqldump --no-defaults
84
+ Debug (db): Running initial shell command: /usr/bin/env mysqldump --no-defaults
76
85
"""
Original file line number Diff line number Diff line change @@ -12,6 +12,18 @@ Feature: Import a WordPress database
12
12
Success: Imported from 'wp_cli_test.sql'.
13
13
"""
14
14
15
+ Scenario : Import from database name path by default with mysql defaults
16
+ Given a WP install
17
+
18
+ When I run `wp db export wp_cli_test.sql`
19
+ Then the wp_cli_test.sql file should exist
20
+
21
+ When I run `wp db import --defaults`
22
+ Then STDOUT should be:
23
+ """
24
+ Success: Imported from 'wp_cli_test.sql'.
25
+ """
26
+
15
27
Scenario : Import from STDIN
16
28
Given a WP install
17
29
@@ -104,7 +116,7 @@ Feature: Import a WordPress database
104
116
"""
105
117
wp db import
106
118
"""
107
- Scenario : Ensure MySQL defaults are available when as appropriate with --defaults flag
119
+ Scenario : MySQL defaults are available as appropriate with --defaults flag
108
120
Given a WP install
109
121
110
122
When I run `wp db export wp_cli_test.sql`
@@ -113,11 +125,11 @@ Feature: Import a WordPress database
113
125
When I try `wp db import --defaults --debug`
114
126
Then STDERR should contain:
115
127
"""
116
- Debug (db): /usr/bin/env mysql --no-auto-rehash
128
+ Debug (db): Running shell command: /usr/bin/env mysql --no-auto-rehash
117
129
"""
118
130
119
131
When I try `wp db import --debug`
120
132
Then STDERR should contain:
121
133
"""
122
- Debug (db): /usr/bin/env mysql --no-defaults --no-auto-rehash
134
+ Debug (db): Running shell command: /usr/bin/env mysql --no-defaults --no-auto-rehash
123
135
"""
Original file line number Diff line number Diff line change @@ -38,17 +38,34 @@ Feature: Query the database with WordPress' MySQL config
38
38
"""
39
39
And STDOUT should be empty
40
40
41
- Scenario : Ensure MySQL defaults are available when as appropriate with --defaults flag
41
+ Scenario : Database querying with MySQL defaults and passed-in options
42
+ Given a WP install
43
+
44
+ When I run `wp db query --defaults "SELECT COUNT(ID) FROM wp_posts;" --dbuser=wp_cli_test --html`
45
+ Then STDOUT should contain:
46
+ """
47
+ <TABLE
48
+ """
49
+
50
+ When I try `wp db query --defaults "SELECT COUNT(ID) FROM wp_posts;" --dbuser=no_such_user`
51
+ Then the return code should not be 0
52
+ And STDERR should contain:
53
+ """
54
+ Access denied
55
+ """
56
+ And STDOUT should be empty
57
+
58
+ Scenario : MySQL defaults are available as appropriate with --defaults flag
42
59
Given a WP install
43
60
44
61
When I try `wp db query --defaults --debug`
45
62
Then STDERR should contain:
46
63
"""
47
- Debug (db): /usr/bin/env mysql --no-auto-rehash
64
+ Debug (db): Running shell command: /usr/bin/env mysql --no-auto-rehash
48
65
"""
49
66
50
67
When I try `wp db query --debug`
51
68
Then STDERR should contain:
52
69
"""
53
- Debug (db): /usr/bin/env mysql --no-defaults --no-auto-rehash
70
+ Debug (db): Running shell command: /usr/bin/env mysql --no-defaults --no-auto-rehash
54
71
"""
You can’t perform that action at this time.
0 commit comments