mirror of
https://gh.wpcy.net/https://github.com/nlemoine/wp-cli-fixtures.git
synced 2026-05-24 16:35:09 +08:00
42 lines
1.1 KiB
Gherkin
42 lines
1.1 KiB
Gherkin
Feature: Attachment fixtures
|
|
|
|
Scenario: Generate attachments
|
|
Given a WP install
|
|
And a fixtures.yml file:
|
|
"""
|
|
Hellonico\Fixtures\Entity\Attachment:
|
|
attachment{1..5}:
|
|
post_title: <sentence()>
|
|
post_date: <dateTimeThisDecade()>
|
|
file: <picsum(<uploadDir()>, 200, 200)>
|
|
"""
|
|
|
|
When I run `wp fixtures load`
|
|
Then STDOUT should contain:
|
|
"""
|
|
5 attachments have been successfully created
|
|
"""
|
|
|
|
When I run `wp post list --post_type=attachment --meta_key=_fake --format=count`
|
|
Then STDOUT should be:
|
|
"""
|
|
5
|
|
"""
|
|
|
|
Scenario: Delete attachments
|
|
Given a WP install
|
|
And a fixtures.yml file:
|
|
"""
|
|
Hellonico\Fixtures\Entity\Attachment:
|
|
attachment{1..5}:
|
|
post_title: <sentence()>
|
|
post_date: <dateTimeThisDecade()>
|
|
file: <picsum(<uploadDir()>, 200, 200)>
|
|
"""
|
|
|
|
When I run `wp fixtures load`
|
|
When I run `wp fixtures delete attachment --yes`
|
|
Then STDOUT should contain:
|
|
"""
|
|
5 attachments have been successfully deleted
|
|
"""
|