|
| 1 | +Feature: Manage term custom fields |
| 2 | + |
| 3 | + @require-wp-4.4 |
| 4 | + Scenario: Migrate a term that exist |
| 5 | + Given a WP install |
| 6 | + |
| 7 | + When I run `wp term create category apple` |
| 8 | + Then STDOUT should not be empty |
| 9 | + |
| 10 | + When I run `wp post create --post_title='Test post' --porcelain` |
| 11 | + Then STDOUT should be a number |
| 12 | + And save STDOUT as {POST_ID} |
| 13 | + |
| 14 | + When I run `wp post term set {POST_ID} category apple` |
| 15 | + Then STDOUT should not be empty |
| 16 | + |
| 17 | + When I run `wp term migrate apple --by=slug --from=category --to=post_tag` |
| 18 | + Then STDOUT should be: |
| 19 | + """ |
| 20 | + Term 'apple' assigned to post 4. |
| 21 | + Term 'apple' migrated! |
| 22 | + Old instance of term 'apple' removed from its original taxonomy. |
| 23 | + Success: Migrated the term 'apple' from taxonomy 'category' to taxonomy 'post_tag' for 1 post |
| 24 | + """ |
| 25 | + |
| 26 | + Scenario: Migrate a term in multiple posts |
| 27 | + Given a WP install |
| 28 | + |
| 29 | + When I run `wp term create category orange` |
| 30 | + Then STDOUT should not be empty |
| 31 | + |
| 32 | + When I run `wp post create --post_title='Test post' --porcelain` |
| 33 | + Then STDOUT should be a number |
| 34 | + And save STDOUT as {POST_ID} |
| 35 | + |
| 36 | + When I run `wp post term set {POST_ID} category orange` |
| 37 | + Then STDOUT should not be empty |
| 38 | + |
| 39 | + When I run `wp post create --post_title='Test post 2' --porcelain` |
| 40 | + Then STDOUT should be a number |
| 41 | + And save STDOUT as {POST_ID} |
| 42 | + |
| 43 | + When I run `wp post term set {POST_ID} category orange` |
| 44 | + Then STDOUT should not be empty |
| 45 | + |
| 46 | + When I run `wp term migrate orange --by=slug --from=category --to=post_tag` |
| 47 | + Then STDOUT should be: |
| 48 | + """ |
| 49 | + Term 'orange' assigned to post 4. |
| 50 | + Term 'orange' assigned to post 5. |
| 51 | + Term 'orange' migrated! |
| 52 | + Old instance of term 'orange' removed from its original taxonomy. |
| 53 | + Success: Migrated the term 'orange' from taxonomy 'category' to taxonomy 'post_tag' for 2 posts |
| 54 | + """ |
| 55 | + |
| 56 | + @require-wp-4.4 |
| 57 | + Scenario: Migrate a term that not exist |
| 58 | + Given a WP install |
| 59 | + |
| 60 | + When I run `wp term migrate peach --by=slug --from=category --to=post_tag` |
| 61 | + Then STDERR should be: |
| 62 | + """ |
| 63 | + Error: Taxonomy term `peach` for taxonomy `category` doesn't exist. |
| 64 | + """ |
0 commit comments