@@ -365,18 +365,35 @@ Feature: Manage WordPress posts
365
365
| Publish post | publish -post | publish |
366
366
| Sample Page | sample -page | publish |
367
367
368
- When I run `wp post create --post_title='old post' --post_date='2023-01-24T09:52:00.000Z' `
369
- And I run `wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z' `
370
- And I run `wp post list --field=post_title --date_query='{"before":{"year":"2024"}}' `
371
- Then STDOUT should contain:
368
+ Scenario : List posts with date query
369
+ When I run `wp post create --post_title='old post' --post_date='2023-01-24T09:52:00.000Z' `
370
+ And I run `wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z' `
371
+ And I run `wp post list --field=post_title --date_query='{"before":{"year":"2024"}}' `
372
+ Then STDOUT should contain:
372
373
"""
373
374
old post
374
375
"""
375
- And STDOUT should not contain:
376
- """
376
+ And STDOUT should not contain:
377
+ """
377
378
new post
378
379
"""
379
380
381
+ Scenario : List posts with tax query
382
+ When I run `wp term create category "First Category" --porcelain`
383
+ When I run `wp term create category "Second Category" --porcelain`
384
+ When I run `wp post create --post_title='post-1' --post_category="First Category" `
385
+ When I run `wp post create --post_title='post-2' --post_category="Second Category" `
386
+ And I run `wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z' `
387
+ And I run `wp post list --field=post_title --tax_query='[{"taxonomy":"category","field":"slug","terms":"first-category"}]' `
388
+ Then STDOUT should contain:
389
+ """
390
+ post-1
391
+ """
392
+ And STDOUT should not contain:
393
+ """
394
+ post-2
395
+ """
396
+
380
397
Scenario : Update categories on a post
381
398
When I run `wp term create category "Test Category" --porcelain`
382
399
Then save STDOUT as {TERM_ID}
@@ -427,6 +444,12 @@ Feature: Manage WordPress posts
427
444
| {POST_ID } | key2 | value2b |
428
445
| {POST_ID } | key3 | value3 |
429
446
447
+ When I run `wp post list --field=post_title --meta_query='[{"key":"key2","value":"value2b"}]' `
448
+ Then STDOUT should contain:
449
+ """
450
+ Test Post
451
+ """
452
+
430
453
@less-than-wp-4.4
431
454
Scenario : Creating/updating posts with meta keys for WP < 4.4 has no effect so should give warning
432
455
When I try `wp post create --post_title='Test Post' --post_content='Test post content' --meta_input='{"key1":"value1","key2":"value2"}' --porcelain`
0 commit comments