When I run `wp post get --format=table {POST_ID}`
Then STDOUT should be a table containing rows:
- """
- Field Value
- ID {POST_ID}
- post_title Test post
- """
+ | Field | Value |
+ | ID | {POST_ID} |
+ | post_title | Test post |
When I run `wp post get --format=json {POST_ID}`
Then STDOUT should be JSON containing:
And I run `wp search-replace {SITEURL} {SITEURL}/subdir`
Then STDOUT should be a table containing rows:
- """
- Table Column Replacements
- wp_posts guid 1002
- """
+ | Table | Column | Replacements |
+ | wp_posts | guid | 1002 |
+
Scenario: Large guid search/replace where replacement does not contain search
Given a WP install
And I run `wp search-replace {SITEURL} http://newdomain.com`
Then STDOUT should be a table containing rows:
- """
- Table Column Replacements
- wp_posts guid 1002
- """
+ | Table | Column | Replacements |
+ | wp_posts | guid | 1002 |
Scenario: Large guid search/replace dry run where replacement does not contain search
Given a WP install
And I run `wp search-replace --dry-run {SITEURL} http://newdomain.com`
Then STDOUT should be a table containing rows:
- """
- Table Column Replacements
- wp_posts guid 1002
- """
+ | Table | Column | Replacements |
+ | wp_posts | guid | 1002 |
);
$steps->Then( '/^STDOUT should be a table containing rows:$/',
- function ( $world, PyStringNode $expected ) {
+ function ( $world, TableNode $expected ) {
$output = $world->result->STDOUT;
$outputRows = explode( "\n", rtrim( $output, "\n" ) );
- $expected = $world->replace_variables( (string) $expected );
- $expectedRows = explode( "\n", rtrim( $expected, "\n" ) );
+ $expectedRows = array();
+ foreach ( $expected->getRows() as $row ) {
+ $expectedRows[] = $world->replace_variables( implode( "\t", $row ) );
+ }
// the first row is the header and must be present
if ( $expectedRows[0] != $outputRows[0] ) {