Skip to content

Commit 49ac394

Browse files
authored
Merge branch 'main' into add-term-meta
2 parents b32ab97 + 2eb9ad1 commit 49ac394

5 files changed

Lines changed: 80 additions & 21 deletions

File tree

‎.github/workflows/testing.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Testing
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
push:
67
branches:

‎composer.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"nb/oxymel": "~0.1.0",
16-
"wp-cli/wp-cli": "^2.5"
16+
"wp-cli/wp-cli": "^2.12"
1717
},
1818
"require-dev": {
1919
"wp-cli/db-command": "^1.3 || ^2",
@@ -29,7 +29,8 @@
2929
"allow-plugins": {
3030
"dealerdirect/phpcodesniffer-composer-installer": true,
3131
"johnpbloch/wordpress-core-installer": true
32-
}
32+
},
33+
"lock": false
3334
},
3435
"extra": {
3536
"branch-alias": {

‎features/export.feature‎

Lines changed: 74 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Feature: Export content.
4040
"""
4141
And the return code should be 1
4242

43-
@require-wp-5.2
43+
@require-wp-5.2 @require-mysql
4444
Scenario: Export with post_type and post_status argument
4545
Given a WP install
4646

@@ -79,7 +79,7 @@ Feature: Export content.
7979
10
8080
"""
8181

82-
@require-wp-5.2
82+
@require-wp-5.2 @require-mysql
8383
Scenario: Export a comma-separated list of post types
8484
Given a WP install
8585

@@ -132,7 +132,7 @@ Feature: Export content.
132132
10
133133
"""
134134

135-
@require-wp-5.2
135+
@require-wp-5.2 @require-mysql
136136
Scenario: Export only one post
137137
Given a WP install
138138

@@ -204,7 +204,7 @@ Feature: Export content.
204204
2
205205
"""
206206

207-
@require-wp-5.2
207+
@require-wp-5.2 @require-mysql
208208
Scenario: Export multiple posts, separated by spaces
209209
Given a WP install
210210

@@ -237,7 +237,7 @@ Feature: Export content.
237237
2
238238
"""
239239

240-
@require-wp-5.2
240+
@require-wp-5.2 @require-mysql
241241
Scenario: Export multiple posts, separated by comma
242242
Given a WP install
243243

@@ -270,7 +270,7 @@ Feature: Export content.
270270
2
271271
"""
272272

273-
@require-wp-5.2
273+
@require-wp-5.2 @require-mysql
274274
Scenario: Export posts within a given date range
275275
Given a WP install
276276

@@ -311,7 +311,7 @@ Feature: Export content.
311311
10
312312
"""
313313

314-
@require-wp-5.2
314+
@require-wp-5.2 @require-mysql
315315
Scenario: Export posts from a given category
316316
Given a WP install
317317
And I run `wp site empty --yes`
@@ -393,7 +393,7 @@ Feature: Export content.
393393
Apple Post
394394
"""
395395

396-
@require-wp-5.2
396+
@require-wp-5.2 @require-mysql
397397
Scenario: Export posts from a given author
398398
Given a WP install
399399
And I run `wp site empty --yes`
@@ -476,7 +476,7 @@ Feature: Export content.
476476
john.doe@example.com
477477
"""
478478

479-
@require-wp-5.2
479+
@require-wp-5.2 @require-mysql
480480
Scenario: Export posts should include user information
481481
Given a WP install
482482
And I run `wp plugin install wordpress-importer --activate`
@@ -503,7 +503,7 @@ Feature: Export content.
503503
Test User
504504
"""
505505

506-
@require-wp-5.2
506+
@require-wp-5.2 @require-mysql
507507
Scenario: Export posts from a given starting post ID
508508
Given a WP install
509509

@@ -542,7 +542,7 @@ Feature: Export content.
542542
5
543543
"""
544544

545-
@require-wp-5.2
545+
@require-wp-5.2 @require-mysql
546546
Scenario: Exclude a specific post type from export
547547
Given a WP install
548548
And I run `wp site empty --yes`
@@ -605,6 +605,7 @@ Feature: Export content.
605605
0
606606
"""
607607

608+
@require-mysql
608609
Scenario: Export posts using --max_num_posts
609610
Given a WP install
610611
And I run `wp site empty --yes`
@@ -648,7 +649,7 @@ Feature: Export content.
648649
000.xml
649650
"""
650651

651-
@require-wp-5.2
652+
@require-wp-5.2 @require-mysql
652653
Scenario: Export a site and skip the comments
653654
Given a WP install
654655
And I run `wp comment generate --post_id=1 --count=2`
@@ -787,6 +788,7 @@ Feature: Export content.
787788
<wp:tag>
788789
"""
789790

791+
@require-mysql
790792
Scenario: Export without splitting the dump
791793
Given a WP install
792794
# Make export file > 15MB so will split by default. Need to split into 4 * 4MB to stay below 10% of default redo log size of 48MB, otherwise get MySQL error.
@@ -828,7 +830,7 @@ Feature: Export content.
828830
"""
829831
And STDERR should be empty
830832

831-
@require-wp-5.2
833+
@require-wp-5.2 @require-mysql
832834
Scenario: Export a site to stdout
833835
Given a WP install
834836
And I run `wp comment generate --post_id=1 --count=1`
@@ -882,7 +884,7 @@ Feature: Export content.
882884
"""
883885
And the return code should be 1
884886

885-
@require-wp-5.2
887+
@require-wp-5.2 @require-mysql
886888
Scenario: Export individual post with attachments
887889
Given a WP install
888890
And I run `wp plugin install wordpress-importer --activate`
@@ -974,7 +976,7 @@ Feature: Export content.
974976
white-150-square.jpg";s:
975977
"""
976978

977-
@require-wp-5.2
979+
@require-wp-5.2 @require-mysql
978980
Scenario: Export categories, tags and terms
979981
Given a WP install
980982
And a wp-content/mu-plugins/register-region-taxonomy.php file:
@@ -1139,7 +1141,7 @@ Feature: Export content.
11391141
Europe
11401142
"""
11411143

1142-
@require-wp-5.2
1144+
@require-wp-5.2 @require-mysql
11431145
Scenario: Export posts should not include oembed_cache posts user information
11441146
Given a WP install
11451147
And I run `wp plugin install wordpress-importer --activate`
@@ -1171,7 +1173,7 @@ Feature: Export content.
11711173
Test User
11721174
"""
11731175

1174-
@require-wp-5.2
1176+
@require-wp-5.2 @require-mysql
11751177
Scenario: Allow export to proceed when orphaned terms are found
11761178
Given a WP install
11771179
And I run `wp term create category orphan --parent=1`
@@ -1226,6 +1228,7 @@ Feature: Export content.
12261228
0
12271229
"""
12281230

1231+
@require-mysql
12291232
Scenario: Throw exception when orphaned terms are found
12301233
Given a WP install
12311234
And I run `wp term create category orphan --parent=1`
@@ -1235,4 +1238,57 @@ Feature: Export content.
12351238
Then STDERR should contain:
12361239
"""
12371240
Error: Term is missing a parent
1238-
"""
1241+
"""
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;

‎src/WP_Map_Iterator.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public function __construct( $iterator, $callback ) {
66
parent::__construct( $iterator );
77
}
88

9+
#[\ReturnTypeWillChange]
910
public function current() {
1011
$original_current = parent::current();
1112
return call_user_func( $this->callback, $original_current );

0 commit comments

Comments
 (0)