mirror of
https://gh.wpcy.net/https://github.com/wp-cli/entity-command.git
synced 2026-05-01 12:38:58 +08:00
24 lines
No EOL
564 B
Gherkin
24 lines
No EOL
564 B
Gherkin
Feature: Get the post ID for a given URL
|
|
|
|
Background:
|
|
Given a WP install
|
|
|
|
Scenario: Get the post ID for a given URL
|
|
When I run `wp post get 1 --field=url`
|
|
Then STDOUT should be:
|
|
"""
|
|
https://example.com/?p=1
|
|
"""
|
|
And save STDOUT as {POST_URL}
|
|
|
|
When I run `wp post url-to-id {POST_URL}`
|
|
Then STDOUT should contain:
|
|
"""
|
|
1
|
|
"""
|
|
|
|
When I try `wp post url-to-id 'https://example.com/?p=404'`
|
|
Then STDERR should contain:
|
|
"""
|
|
Could not get post with url https://example.com/?p=404.
|
|
""" |