Skip to content

Commit 31bc9e4

Browse files
committed
add example and test for exporting to stdout
1 parent 34bbe19 commit 31bc9e4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

features/db-export.feature

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feature: Export a WordPress database
2020
"""
2121
And the wp_cli_test.sql file should exist
2222

23-
Scenario: Exclude tables when exporting the dtabase
23+
Scenario: Exclude tables when exporting the database
2424
Given a WP install
2525

2626
When I run `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
@@ -33,3 +33,12 @@ Feature: Export a WordPress database
3333
"""
3434
wp_options
3535
"""
36+
37+
Scenario: Export database to STDOUT
38+
Given a WP install
39+
40+
When I run `wp db export -`
41+
Then STDOUT should contain:
42+
"""
43+
-- MySQL dump
44+
"""

src/DB_Command.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,15 @@ public function query( $args, $assoc_args ) {
302302
* $ wp db export --exclude_tables=$(wp db tables --all-tables-with-prefix --format=csv)
303303
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.
304304
*
305+
* # Export database to STDOUT.
306+
* $ wp db export -
307+
* -- MySQL dump 10.13 Distrib 5.7.19, for osx10.12 (x86_64)
308+
* --
309+
* -- Host: localhost Database: wpdev
310+
* -- ------------------------------------------------------
311+
* -- Server version 5.7.19
312+
* ...
313+
*
305314
* @alias dump
306315
*/
307316
public function export( $args, $assoc_args ) {

0 commit comments

Comments
 (0)