Skip to content

Commit 65f6886

Browse files
committed
Make Behat scenarios SQLite-compatible
1 parent ddbf8c0 commit 65f6886

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

features/export.feature

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ Feature: Export content.
502502
Test User
503503
"""
504504

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

@@ -520,7 +520,11 @@ Feature: Export content.
520520
10
521521
"""
522522

523-
When I run `wp export --start_id=6`
523+
# Read the 6th post's ID instead of hardcoding --start_id=6. SQLite does not reset auto-increment on `wp site empty`, so generated IDs aren't always 1..10.
524+
When I run `wp post list --post_type=post --orderby=ID --order=ASC --posts_per_page=1 --offset=5 --format=ids`
525+
Then save STDOUT as {START_ID}
526+
527+
When I run `wp export --start_id={START_ID}`
524528
Then save STDOUT 'Writing to file %s' as {EXPORT_FILE}
525529

526530
When I run `wp site empty --yes`
@@ -801,14 +805,13 @@ Feature: Export content.
801805
<wp:tag>
802806
"""
803807

804-
@require-mysql
805808
Scenario: Export without splitting the dump
806809
Given a WP install
807-
# 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.
808-
And I run `wp db query "INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (1, '_dummy', REPEAT( 'A', 4 * 1024 * 1024 ) );"`
809-
And I run `wp db query "INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (1, '_dummy', REPEAT( 'A', 4 * 1024 * 1024 ) );"`
810-
And I run `wp db query "INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (1, '_dummy', REPEAT( 'A', 4 * 1024 * 1024 ) );"`
811-
And I run `wp db query "INSERT INTO wp_postmeta (post_id, meta_key, meta_value) VALUES (1, '_dummy', REPEAT( 'A', 4 * 1024 * 1024 ) );"`
810+
# 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. Use `wp eval` + `str_repeat` because SQLite has no REPEAT() function.
811+
And I run `wp eval "update_post_meta(1, '_dummy_0', str_repeat('A', 4 * 1024 * 1024));"`
812+
And I run `wp eval "update_post_meta(1, '_dummy_1', str_repeat('A', 4 * 1024 * 1024));"`
813+
And I run `wp eval "update_post_meta(1, '_dummy_2', str_repeat('A', 4 * 1024 * 1024));"`
814+
And I run `wp eval "update_post_meta(1, '_dummy_3', str_repeat('A', 4 * 1024 * 1024));"`
812815

813816
When I run `wp export`
814817
Then STDOUT should contain:

0 commit comments

Comments
 (0)