|
1 | 1 | Feature: Create Duplicate WordPress post from existing posts. |
2 | 2 |
|
3 | 3 | Background: |
4 | | - Given a WP install |
| 4 | + Given a WP install |
5 | 5 |
|
6 | 6 | Scenario: Generate duplicate post. |
7 | | - When I run `wp term create category "Test Category" --porcelain` |
8 | | - Then save STDOUT as {TERM_ID} |
| 7 | + When I run `wp term create category "Test Category" --porcelain` |
| 8 | + Then save STDOUT as {TERM_ID} |
9 | 9 |
|
10 | | - When I run `wp term create post_tag "Test Tag" --porcelain` |
11 | | - Then save STDOUT as {TAG_ID} |
| 10 | + When I run `wp term create post_tag "Test Tag" --porcelain` |
| 11 | + Then save STDOUT as {TAG_ID} |
12 | 12 |
|
13 | | - When I run `wp post create --post_title='Test Duplicate Post' --post_category={TERM_ID} --porcelain` |
14 | | - And save STDOUT as {POST_ID} |
| 13 | + When I run `wp post create --post_title='Test Duplicate Post' --post_category={TERM_ID} --porcelain` |
| 14 | + Then save STDOUT as {POST_ID} |
15 | 15 |
|
16 | | - When I run `wp post term add {POST_ID} post_tag {TAG_ID} --by=id` |
17 | | - Then STDOUT should contain: |
| 16 | + When I run `wp post term add {POST_ID} post_tag {TAG_ID} --by=id` |
| 17 | + Then STDOUT should contain: |
18 | 18 | """ |
19 | 19 | Success: Added term. |
20 | 20 | """ |
21 | 21 |
|
22 | | - When I run `wp post create --from-post={POST_ID} --porcelain` |
23 | | - Then STDOUT should be a number |
24 | | - And save STDOUT as {DUPLICATE_POST_ID} |
| 22 | + When I run `wp post create --from-post={POST_ID} --porcelain` |
| 23 | + Then STDOUT should be a number |
| 24 | + And save STDOUT as {DUPLICATE_POST_ID} |
25 | 25 |
|
26 | | - When I run `wp post get {DUPLICATE_POST_ID} --field=title` |
27 | | - Then STDOUT should be: |
28 | | - """ |
29 | | - Test Duplicate Post |
30 | | - """ |
| 26 | + When I run `wp post get {DUPLICATE_POST_ID} --field=title` |
| 27 | + Then STDOUT should be: |
| 28 | + """ |
| 29 | + Test Duplicate Post |
| 30 | + """ |
31 | 31 |
|
32 | | - When I run `wp post term list {DUPLICATE_POST_ID} category --field=term_id` |
33 | | - Then STDOUT should be: |
| 32 | + When I run `wp post term list {DUPLICATE_POST_ID} category --field=term_id` |
| 33 | + Then STDOUT should be: |
34 | 34 | """ |
35 | 35 | {TERM_ID} |
36 | 36 | """ |
37 | 37 |
|
38 | | - When I run `wp post term list {DUPLICATE_POST_ID} post_tag --field=term_id` |
39 | | - Then STDOUT should be: |
| 38 | + When I run `wp post term list {DUPLICATE_POST_ID} post_tag --field=term_id` |
| 39 | + Then STDOUT should be: |
40 | 40 | """ |
41 | 41 | {TAG_ID} |
42 | 42 | """ |
43 | 43 |
|
44 | 44 | @require-wp-4.4 |
45 | 45 | Scenario: Generate duplicate post with post metadata. |
46 | | - When I run `wp post create --post_title='Test Post' --meta_input='{"key1":"value1","key2":"value2"}' --porcelain` |
47 | | - Then save STDOUT as {POST_ID} |
| 46 | + When I run `wp post create --post_title='Test Post' --meta_input='{"key1":"value1","key2":"value2"}' --porcelain` |
| 47 | + Then save STDOUT as {POST_ID} |
48 | 48 |
|
49 | | - When I run `wp post create --from-post={POST_ID} --porcelain` |
50 | | - Then save STDOUT as {DUPLICATE_POST_ID} |
| 49 | + When I run `wp post create --from-post={POST_ID} --porcelain` |
| 50 | + Then save STDOUT as {DUPLICATE_POST_ID} |
51 | 51 |
|
52 | | - When I run `wp post meta list {DUPLICATE_POST_ID} --format=table` |
53 | | - Then STDOUT should be a table containing rows: |
| 52 | + When I run `wp post meta list {DUPLICATE_POST_ID} --format=table` |
| 53 | + Then STDOUT should be a table containing rows: |
54 | 54 | | post_id | meta_key | meta_value | |
55 | 55 | | {DUPLICATE_POST_ID} | key1 | value1 | |
56 | 56 | | {DUPLICATE_POST_ID} | key2 | value2 | |
57 | 57 |
|
58 | | - |
59 | 58 | Scenario: Generate duplicate page. |
60 | | - When I run `wp post create --post_type="page" --post_title="Test Page" --post_content="Page Content" --porcelain` |
61 | | - Then save STDOUT as {POST_ID} |
| 59 | + When I run `wp post create --post_type="page" --post_title="Test Page" --post_content="Page Content" --porcelain` |
| 60 | + Then save STDOUT as {POST_ID} |
62 | 61 |
|
63 | | - When I run `wp post create --from-post={POST_ID} --post_title="Duplicate Page" --porcelain` |
64 | | - Then save STDOUT as {DUPLICATE_POST_ID} |
| 62 | + When I run `wp post create --from-post={POST_ID} --post_title="Duplicate Page" --porcelain` |
| 63 | + Then save STDOUT as {DUPLICATE_POST_ID} |
65 | 64 |
|
66 | | - When I run `wp post list --post_type='page' --fields="title, content, type"` |
67 | | - Then STDOUT should be a table containing rows: |
| 65 | + When I run `wp post list --post_type='page' --fields="title, content, type"` |
| 66 | + Then STDOUT should be a table containing rows: |
68 | 67 | | post_title | post_content | post_type | |
69 | 68 | | Test Page | Page Content | page | |
70 | 69 | | Duplicate Page | Page Content | page | |
71 | 70 |
|
72 | 71 | Scenario: Change type of duplicate post. |
73 | | - When I run `wp post create --post_title='Test Post' --porcelain` |
74 | | - Then save STDOUT as {POST_ID} |
| 72 | + When I run `wp post create --post_title='Test Post' --porcelain` |
| 73 | + Then save STDOUT as {POST_ID} |
75 | 74 |
|
76 | | - When I run `wp post create --from-post={POST_ID} --post_type=page --porcelain` |
77 | | - Then save STDOUT as {DUPLICATE_POST_ID} |
| 75 | + When I run `wp post create --from-post={POST_ID} --post_type=page --porcelain` |
| 76 | + Then save STDOUT as {DUPLICATE_POST_ID} |
78 | 77 |
|
79 | | - When I run `wp post get {DUPLICATE_POST_ID} --fields=type` |
80 | | - Then STDOUT should be a table containing rows: |
| 78 | + When I run `wp post get {DUPLICATE_POST_ID} --fields=type` |
| 79 | + Then STDOUT should be a table containing rows: |
81 | 80 | | Field | Value | |
82 | 81 | | post_type | page | |
0 commit comments