-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathdb-export.feature
More file actions
107 lines (86 loc) · 2.96 KB
/
db-export.feature
File metadata and controls
107 lines (86 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Feature: Export a WordPress database
Scenario: Database exports with random hash applied
Given a WP install
When I run `wp db export --porcelain`
Then STDOUT should contain:
"""
wp_cli_test-
"""
And the wp_cli_test.sql file should not exist
Scenario: Database export to a specified file path
Given a WP install
When I run `wp db export wp_cli_test.sql --porcelain`
Then STDOUT should contain:
"""
wp_cli_test.sql
"""
And the wp_cli_test.sql file should exist
Scenario: Exclude tables when exporting the database
Given a WP install
When I run `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
Then the wp_cli_test.sql file should exist
And the wp_cli_test.sql file should not contain:
"""
wp_users
"""
And the wp_cli_test.sql file should contain:
"""
wp_options
"""
# Only MariaDB currently supports this feature.
@require-mariadb
Scenario: Exclude data of certain tables when exporting the database
Given a WP install
When I run `wp db export wp_cli_test.sql --exclude_tables_data=wp_users --porcelain`
Then the wp_cli_test.sql file should exist
And the wp_cli_test.sql file should contain:
"""
wp_users
"""
And the wp_cli_test.sql file should not contain:
"""
INSERT INTO `wp_users`
"""
Scenario: Export database to STDOUT
Given a WP install
When I run `wp db export -`
Then STDOUT should contain:
"""
-- Dump completed on
"""
Scenario: Export database with mysql defaults to STDOUT
Given a WP install
When I run `wp db export --defaults -`
Then STDOUT should contain:
"""
-- Dump completed on
"""
Scenario: Export database with mysql --no-defaults to STDOUT
Given a WP install
When I run `wp db export --no-defaults -`
Then STDOUT should contain:
"""
-- Dump completed on
"""
Scenario: Export database with passed-in options
Given a WP install
When I run `wp db export - --dbpass=password1 --skip-comments`
Then STDOUT should not contain:
"""
-- Table structure
"""
When I try `wp db export - --dbpass=no_such_pass`
Then the return code should not be 0
And STDERR should contain:
"""
Access denied
"""
And STDOUT should be empty
Scenario: MySQL defaults are available as appropriate with --defaults flag
Given a WP install
When I try `wp db export --defaults --debug`
Then STDERR should match #Debug \(db\): Running initial shell command: /usr/bin/env (mysqldump|mariadb-dump)#
When I try `wp db export --debug`
Then STDERR should match #Debug \(db\): Running initial shell command: /usr/bin/env (mysqldump|mariadb-dump) --no-defaults#
When I try `wp db export --no-defaults --debug`
Then STDERR should match #Debug \(db\): Running initial shell command: /usr/bin/env (mysqldump|mariadb-dump) --no-defaults#