11Feature : Perform database operations
22
3+ @require-mysql-or-mariadb
34 Scenario : DB CRUD
45 Given an empty directory
56 And WP files
@@ -52,6 +53,7 @@ Feature: Perform database operations
5253 Are you sure you want to reset the 'wp_cli_test' database? [y/n] Success: Database reset.
5354 """
5455
56+ @require-mysql-or-mariadb
5557 Scenario: DB CRUD with passed-in dbuser/dbpass
5658 Given an empty directory
5759 And WP files
@@ -107,6 +109,7 @@ Feature: Perform database operations
107109 """
108110 And STDOUT should be empty
109111
112+ @require-mysql-or-mariadb
110113 Scenario: Clean up a WordPress install without dropping its database entirely but tables with prefix.
111114 Given a WP install
112115
@@ -138,6 +141,7 @@ Feature: Perform database operations
138141 """
139142 And the return code should be 0
140143
144+ @require-mysql-or-mariadb
141145 Scenario: DB Operations
142146 Given a WP install
143147
@@ -147,6 +151,7 @@ Feature: Perform database operations
147151 When I run `wp db repair`
148152 Then STDOUT should not be empty
149153
154+ @require-mysql-or-mariadb
150155 Scenario: DB Operations with passed-in options
151156 Given a WP install
152157
@@ -185,6 +190,7 @@ Feature: Perform database operations
185190 """
186191 And STDOUT should not be empty
187192
193+ @require-mysql-or-mariadb
188194 Scenario: DB Query
189195 Given a WP install
190196
@@ -214,6 +220,7 @@ Feature: Perform database operations
214220 home
215221 """
216222
223+ @require-mysql-or-mariadb
217224 Scenario: DB export/import
218225 Given a WP install
219226
@@ -262,6 +269,7 @@ Feature: Perform database operations
262269 1
263270 """
264271
272+ @require-mysql-or-mariadb
265273 Scenario: DB export no charset
266274 Given an empty directory
267275 And WP files
@@ -327,14 +335,15 @@ Feature: Perform database operations
327335 latin1_spanish_ci
328336 """
329337
338+ @require-mysql-or-mariadb
330339 Scenario: Row modifying queries should return the number of affected rows
331340 Given a WP install
332341 When I run `wp db query "UPDATE wp_users SET user_status = 1 WHERE ID = 1"`
333342 Then STDOUT should contain:
334343 """
335344 Query succeeded. Rows affected: 1
336345 """
337-
346+
338347 When I run `wp db query "SELECT * FROM wp_users WHERE ID = 1"`
339348 Then STDOUT should not contain:
340349 """
@@ -346,3 +355,74 @@ Feature: Perform database operations
346355 """
347356 Query succeeded. Rows affected: 1
348357 """
358+
359+ @require-sqlite
360+ Scenario: SQLite DB CRUD operations
361+ Given a WP install
362+ And a session_yes file:
363+ """
364+ y
365+ """
366+
367+ When I try `wp db create`
368+ Then the return code should be 1
369+ And STDERR should contain:
370+ """
371+ Database already exists
372+ """
373+
374+ When I run `wp db drop < session_yes`
375+ Then STDOUT should contain:
376+ """
377+ Success: Database dropped.
378+ """
379+
380+ When I run `wp db reset < session_yes`
381+ Then STDOUT should contain:
382+ """
383+ Success: Database reset
384+ """
385+
386+ @require-sqlite
387+ Scenario: SQLite DB query
388+ Given a WP install
389+
390+ When I run `wp db query 'SELECT COUNT(*) as total FROM wp_posts'`
391+ Then STDOUT should contain:
392+ """
393+ total
394+ """
395+
396+ @require-sqlite
397+ Scenario: SQLite DB export/import
398+ Given a WP install
399+
400+ When I run `wp post list --format=count`
401+ Then STDOUT should contain:
402+ """
403+ 1
404+ """
405+
406+ When I run `wp db export /tmp/wp-cli-sqlite-behat.sql`
407+ Then STDOUT should contain:
408+ """
409+ Success: Exported
410+ """
411+
412+ When I run `wp db reset < session_yes`
413+ Then STDOUT should contain:
414+ """
415+ Success: Database reset
416+ """
417+
418+ When I run `wp db import /tmp/wp-cli-sqlite-behat.sql`
419+ Then STDOUT should contain:
420+ """
421+ Success: Imported
422+ """
423+
424+ When I run `wp post list --format=count`
425+ Then STDOUT should contain:
426+ """
427+ 1
428+ """
0 commit comments