Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions features/export.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1239,3 +1239,56 @@ Feature: Export content.
"""
Error: Term is missing a parent
"""

@require-wp-5.2 @require-mysql
Scenario: Export posts with future status
Given a WP install
And I run `wp plugin install wordpress-importer --activate`
And I run `wp site empty --yes`

When I run `wp post create --post_title='Future Post 1' --post_status=future --post_date='2050-01-01 12:00:00' --porcelain`
Then STDOUT should be a number
And save STDOUT as {FUTURE_POST_1}

When I run `wp post create --post_title='Future Post 2' --post_status=future --post_date='2050-01-02 12:00:00' --porcelain`
Then STDOUT should be a number
And save STDOUT as {FUTURE_POST_2}

When I run `wp post list --post_status=future --format=count`
Then STDOUT should be:
"""
2
"""

When I run `wp export --post_type=post --post_status=future`
And save STDOUT 'Writing to file %s' as {EXPORT_FILE}
Then the {EXPORT_FILE} file should contain:
"""
<wp:post_id>{FUTURE_POST_1}</wp:post_id>
"""
And the {EXPORT_FILE} file should contain:
"""
<wp:status>future</wp:status>
"""
And the {EXPORT_FILE} file should contain:
"""
<wp:post_date>2050-01-01 12:00:00</wp:post_date>
"""

When I run `wp site empty --yes`
Then STDOUT should not be empty

When I run `wp post list --post_status=future --format=count`
Then STDOUT should be:
"""
0
"""

When I run `wp import {EXPORT_FILE} --authors=skip`
Then STDOUT should not be empty

When I run `wp post list --post_status=future --format=count`
Then STDOUT should be:
"""
2
"""
2 changes: 1 addition & 1 deletion src/Export_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ private function check_post_status( $status ) {
return true;
}

$stati = get_post_statuses();
$stati = get_post_stati();
if ( empty( $stati ) || is_wp_error( $stati ) ) {
WP_CLI::warning( 'Could not find any post stati.' );
return false;
Expand Down
Loading