Skip to content

Commit 2eb9ad1

Browse files
authored
Merge pull request #121 from ouikhuan/fix/post-status-support
2 parents 437b82b + d75c91a commit 2eb9ad1

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

‎features/export.feature‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,3 +1239,56 @@ Feature: Export content.
12391239
"""
12401240
Error: Term is missing a parent
12411241
"""
1242+
1243+
@require-wp-5.2 @require-mysql
1244+
Scenario: Export posts with future status
1245+
Given a WP install
1246+
And I run `wp plugin install wordpress-importer --activate`
1247+
And I run `wp site empty --yes`
1248+
1249+
When I run `wp post create --post_title='Future Post 1' --post_status=future --post_date='2050-01-01 12:00:00' --porcelain`
1250+
Then STDOUT should be a number
1251+
And save STDOUT as {FUTURE_POST_1}
1252+
1253+
When I run `wp post create --post_title='Future Post 2' --post_status=future --post_date='2050-01-02 12:00:00' --porcelain`
1254+
Then STDOUT should be a number
1255+
And save STDOUT as {FUTURE_POST_2}
1256+
1257+
When I run `wp post list --post_status=future --format=count`
1258+
Then STDOUT should be:
1259+
"""
1260+
2
1261+
"""
1262+
1263+
When I run `wp export --post_type=post --post_status=future`
1264+
And save STDOUT 'Writing to file %s' as {EXPORT_FILE}
1265+
Then the {EXPORT_FILE} file should contain:
1266+
"""
1267+
<wp:post_id>{FUTURE_POST_1}</wp:post_id>
1268+
"""
1269+
And the {EXPORT_FILE} file should contain:
1270+
"""
1271+
<wp:status>future</wp:status>
1272+
"""
1273+
And the {EXPORT_FILE} file should contain:
1274+
"""
1275+
<wp:post_date>2050-01-01 12:00:00</wp:post_date>
1276+
"""
1277+
1278+
When I run `wp site empty --yes`
1279+
Then STDOUT should not be empty
1280+
1281+
When I run `wp post list --post_status=future --format=count`
1282+
Then STDOUT should be:
1283+
"""
1284+
0
1285+
"""
1286+
1287+
When I run `wp import {EXPORT_FILE} --authors=skip`
1288+
Then STDOUT should not be empty
1289+
1290+
When I run `wp post list --post_status=future --format=count`
1291+
Then STDOUT should be:
1292+
"""
1293+
2
1294+
"""

‎src/Export_Command.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ private function check_post_status( $status ) {
441441
return true;
442442
}
443443

444-
$stati = get_post_statuses();
444+
$stati = get_post_stati();
445445
if ( empty( $stati ) || is_wp_error( $stati ) ) {
446446
WP_CLI::warning( 'Could not find any post stati.' );
447447
return false;

0 commit comments

Comments
 (0)