@@ -365,18 +365,35 @@ Feature: Manage WordPress posts
365365 | Publish post | publish -post | publish |
366366 | Sample Page | sample -page | publish |
367367
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:
372373 """
373374 old post
374375 """
375- And STDOUT should not contain:
376- """
376+ And STDOUT should not contain:
377+ """
377378 new post
378379 """
379380
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+
380397 Scenario : Update categories on a post
381398 When I run `wp term create category "Test Category" --porcelain`
382399 Then save STDOUT as {TERM_ID}
@@ -427,6 +444,12 @@ Feature: Manage WordPress posts
427444 | {POST_ID } | key2 | value2b |
428445 | {POST_ID } | key3 | value3 |
429446
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+
430453 @less-than-wp-4.4
431454 Scenario : Creating/updating posts with meta keys for WP < 4.4 has no effect so should give warning
432455 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