wp-cli-fixtures/features/term.feature
Ian Jenkins 3f3998cdfb Get the tests passing.
* Get tests running
* Add new Picsum provider due to slow Image provider causing issues with
  tests. It seems LoremPixel is really slow and unreliable.
2020-05-01 11:48:31 +01:00

63 lines
1.5 KiB
Gherkin

Feature: Term fixtures
Scenario: Generate terms
Given a WP install
And a fixtures.yml file:
"""
Hellonico\Fixtures\Entity\Term:
category{1..5}:
name (unique): <words(3, true)>
description: <sentence()>
parent: '50%? <termId(childless=1)>'
tag{1..5}:
name (unique): <words(3, true)>
description: <sentence()>
taxonomy: post_tag
"""
When I run `wp fixtures load`
Then STDOUT should contain:
"""
10 terms have been successfully created
"""
When I run `wp term list $(wp taxonomy list --field=name) --meta_key=_fake --format=count`
Then STDOUT should be:
"""
10
"""
When I run `wp term list category --meta_key=_fake --format=count`
Then STDOUT should be:
"""
5
"""
When I run `wp term list post_tag --meta_key=_fake --format=count`
Then STDOUT should be:
"""
5
"""
Scenario: Delete terms
Given a WP install
And a fixtures.yml file:
"""
Hellonico\Fixtures\Entity\Term:
category{1..5}:
name (unique): <words(3, true)>
description: <sentence()>
parent: '50%? <termId(childless=1)>'
taxonomy: 'category'
tag{1..5}:
name (unique): <words(3, true)>
description: <sentence()>
taxonomy: post_tag
"""
When I run `wp fixtures load`
When I run `wp fixtures delete term --yes`
Then STDOUT should contain:
"""
10 terms have been successfully deleted
"""