@@ -20,20 +20,57 @@ Feature: Export a WordPress database
2020 """
2121 And the wp_cli_test.sql file should exist
2222
23+ @skip-sqlite
2324 Scenario : Exclude tables when exporting the database
2425 Given a WP install
2526
26- When I run `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
27+ When I try `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
2728 Then the wp_cli_test.sql file should exist
28- And the wp_cli_test.sql file should not contain:
29- """
30- wp_users
31- """
32- And the wp_cli_test.sql file should contain:
29+ And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_users[" `]?/
30+ And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_options[" `]?/
31+
32+ @skip-sqlite
33+ Scenario : Include only specific tables when exporting the database
34+ Given a WP install
35+
36+ When I try `wp db export wp_cli_test.sql --tables=wp_users --porcelain`
37+ Then the wp_cli_test.sql file should exist
38+ And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_users[" `]?/
39+ And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_posts[" `]?/
40+ And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_options[" `]?/
41+
42+ @require-sqlite
43+ Scenario : Exclude tables when exporting the database
44+ Given a WP install
45+
46+ When I try `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
47+ Then the wp_cli_test.sql file should exist
48+ And the contents of the wp_cli_test.sql file should not match /_mysql_data_types_cache/
49+ And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_users[" `]?/
50+ And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_options[" `]?/
51+
52+ @require-sqlite
53+ Scenario : Include only specific tables when exporting the database
54+ Given a WP install
55+
56+ When I try `wp db export wp_cli_test.sql --tables=wp_users --porcelain`
57+ Then the wp_cli_test.sql file should exist
58+ And the contents of the wp_cli_test.sql file should not match /_mysql_data_types_cache/
59+ And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_users[" `]?/
60+ And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_posts[" `]?/
61+ And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_options[" `]?/
62+
63+ @require-sqlite
64+ Scenario : Export database to STDOUT
65+ Given a WP install
66+
67+ When I run `wp db export -`
68+ Then STDOUT should contain:
3369 """
34- wp_options
70+ PRAGMA foreign_keys=OFF
3571 """
3672
73+ @skip-sqlite
3774 Scenario : Export database to STDOUT
3875 Given a WP install
3976
@@ -42,7 +79,7 @@ Feature: Export a WordPress database
4279 """
4380 -- Dump completed on
4481 """
45-
82+ @skip-sqlite
4683 Scenario : Export database with mysql defaults to STDOUT
4784 Given a WP install
4885
@@ -52,6 +89,7 @@ Feature: Export a WordPress database
5289 -- Dump completed on
5390 """
5491
92+ @skip-sqlite
5593 Scenario : Export database with mysql --no-defaults to STDOUT
5694 Given a WP install
5795
@@ -61,6 +99,7 @@ Feature: Export a WordPress database
6199 -- Dump completed on
62100 """
63101
102+ @skip-sqlite
64103 Scenario : Export database with passed-in options
65104 Given a WP install
66105
@@ -78,6 +117,25 @@ Feature: Export a WordPress database
78117 """
79118 And STDOUT should be empty
80119
120+ @require-sqlite
121+ Scenario : Export database with passed-in options
122+ Given a WP install
123+
124+ When I run `wp db export - --skip-comments`
125+ Then STDOUT should not contain:
126+ """
127+ -- Table structure
128+ """
129+
130+ # dbpass has no effect on SQLite
131+ When I try `wp db export - --dbpass=no_such_pass`
132+ Then the return code should be 0
133+ And STDERR should not contain:
134+ """
135+ Access denied
136+ """
137+
138+ @skip-sqlite
81139 Scenario : MySQL defaults are available as appropriate with --defaults flag
82140 Given a WP install
83141
0 commit comments