wp-cli-fixtures/features/comment.feature
Nicolas Lemoine f1707ae92f
- Remove tests waiting for wp-cli/wp-cli-tests to resolve dependencies conflicts
- Add `AliceProvider`
- Add formatters (<fileIn>, <fileContent>)
- Add ACF support
2019-04-06 12:19:54 +02:00

70 lines
1.8 KiB
Gherkin

Feature: Comment fixtures
Scenario: Generate comments
Given a WP install
And a fixtures.yml file:
"""
Hellonico\Fixtures\Entity\Comment:
comment{1..5}:
comment_post_ID: <postId()>
user_id: <userId()>
comment_date: <dateTimeThisDecade()>
comment_author: <username()>
comment_author_email: <safeEmail()>
comment_author_url: <url()>
comment_content: <paragraphs(2, true)>
comment_agent: <userAgent()>
comment_author_IP: <ipv4()>
comment_approved: 1
comment_karma: <numberBetween(1, 100)>
comment_meta:
foo_key: <sentence()>
meta:
bar_key: <sentence()>
"""
When I run `wp fixtures load`
Then STDOUT should contain:
"""
5 comments have been successfully created
"""
When I run `wp comment list --meta_key=_fake --format=count`
Then STDOUT should be:
"""
5
"""
When I run `wp comment list --meta_key=foo_key --format=count`
Then STDOUT should be:
"""
5
"""
When I run `wp comment list --meta_key=bar_key --format=count`
Then STDOUT should be:
"""
5
"""
Scenario: Delete comments
Given a WP install
And a fixtures.yml file:
"""
Hellonico\Fixtures\Entity\Comment:
comment{1..5}:
comment_post_ID: <postId()>
user_id: <userId()>
comment_author: <username()>
comment_author_email: <safeEmail()>
comment_content: <paragraphs(2, true)>
comment_agent: <userAgent()>
comment_author_IP: <ipv4()>
"""
When I run `wp fixtures load`
When I run `wp fixtures delete comment --yes`
Then STDOUT should contain:
"""
5 comments have been successfully deleted
"""