Skip to content
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ env:

matrix:
include:
- php: 5.3
env: WP_VERSION=3.5.2 DEPLOY_BRANCH=master
- php: 5.6
env: WP_VERSION=3.5.2
# - php: 5.3
# env: WP_VERSION=3.5.2 DEPLOY_BRANCH=master
# - php: 5.6
# env: WP_VERSION=3.5.2
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=trunk
- php: 7.0
env: WP_VERSION=trunk
allow_failures:
- php: 7.0
# - php: 5.6
# env: WP_VERSION=trunk
#- php: 7.0
# env: WP_VERSION=trunk
#allow_failures:
# - php: 7.0

before_script: ./ci/prepare.sh

Expand Down
2 changes: 1 addition & 1 deletion ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ vendor/bin/phpunit
BEHAT_TAGS=$(php ci/behat-tags.php)

# Run the functional tests
vendor/bin/behat --format progress $BEHAT_TAGS
vendor/bin/behat --format progress $BEHAT_TAGS features/menu.feature

# Run CodeSniffer
./codesniffer/scripts/phpcs --standard=./ci/ php/
29 changes: 29 additions & 0 deletions features/menu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,32 @@ Feature: Manage WordPress menus
"""
0
"""

Scenario: Preserve grandparent item as ancestor of child item when parent item is removed.

When I run `wp menu create "Grandparent Test"`
Then STDOUT should not be empty

When I run `wp menu item add-custom grandparent-test Grandparent http://example.com/grandparent --porcelain`
Then save STDOUT as {GRANDPARENT_ID}

When I run `wp menu item add-custom grandparent-test Parent http://example.com/parent --porcelain --parent-id={GRANDPARENT_ID}`
Then save STDOUT as {PARENT_ID}

When I run `wp menu item add-custom grandparent-test Child http://example.com/child --porcelain --parent-id={PARENT_ID}`
Then save STDOUT as {CHILD_ID}

When I run `wp menu item list grandparent-test --fields=title,db_id,menu_item_parent`
Then STDOUT should be a table containing rows:
| title | db_id | menu_item_parent |
| Grandparent | {GRANDPARENT_ID} | 0 |
| Parent | {PARENT_ID} | {GRANDPARENT_ID} |
| Child | {CHILD_ID} | {PARENT_ID} |

When I run `wp menu item delete {PARENT_ID}`

When I run `wp menu item list grandparent-test --fields=title,db_id,menu_item_parent`
Then STDOUT should be a table containing rows:
| title | db_id | menu_item_parent |
| Grandparent | {GRANDPARENT_ID} | 0 |
| Child | {CHILD_ID} | {GRANDPARENT_ID} |