Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"wp-cli/entity-command": "^1.3 || ^2",
"wp-cli/language-command": "^2.0",
"wp-cli/scaffold-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^4"
"wp-cli/wp-cli-tests": "^4.3.7"
},
"config": {
"process-timeout": 7200,
Expand Down
95 changes: 95 additions & 0 deletions features/plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -810,3 +810,98 @@ Feature: Manage WordPress plugins
"""
5.5
"""

@require-wp-4.0
Scenario: Show plugin update as unavailable if it doesn't meet WordPress requirements
Given a WP install
And a wp-content/plugins/example/example.php file:
"""
<?php
/**
* Plugin Name: Example Plugin
* Version: 1.0.0
* Requires at least: 3.7
* Tested up to: 6.7
"""

Given that HTTP requests to https://api.wordpress.org/plugins/update-check/1.1/ will respond with:
"""
HTTP/1.1 200 OK

{
"plugins": [],
"translations": [],
"no_update": {
"example/example.php": {
"id": "w.org/plugins/example",
"slug": "example",
"plugin": "example/example.php",
"new_version": "2.0.0",

"requires": "100",
"requires_php": "7.2",
"requires_plugins": [],
"compatibility": []
}
}
}
"""

And I run `wp plugin list`
Then STDOUT should be a table containing rows:
| name | status | update | version | update_version | auto_update | requires | requires_php |
| example | inactive | unavailable | 1.0.0 | 2.0.0 | off | 100 | 7.2 |

When I try `wp plugin update example`
Then STDERR should contain:
"""
Warning: example: This update requires WordPress version 100
"""

@require-wp-4.0
Scenario: Show plugin update as unavailable if it doesn't meet PHP requirements
Given a WP install
And a wp-content/plugins/example/example.php file:
"""
<?php
/**
* Plugin Name: Example Plugin
* Version: 1.0.0
* Requires at least: 3.7
* Tested up to: 6.7
"""

Given that HTTP requests to https://api.wordpress.org/plugins/update-check/1.1/ will respond with:
"""
HTTP/1.1 200 OK

{
"plugins": {
"example/example.php": {
"id": "w.org/plugins/example",
"slug": "example",
"plugin": "example/example.php",
"new_version": "2.0.0",
"requires": "3.7",
"tested": "6.6",
"requires_php": "100",
"requires_plugins": [],
"compatibility": []
}
},
"translations": [],
"no_update": []
}
"""

And I run `wp plugin list`
Then STDOUT should be a table containing rows:
| name | status | update | version | update_version | auto_update | requires | requires_php |
| example | inactive | unavailable | 1.0.0 | 2.0.0 | off | 3.7 | 100 |

When I try `wp plugin update example`
Then STDERR should contain:
"""
Warning: example: This update requires PHP version 100
"""

1 change: 1 addition & 0 deletions features/theme-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Feature: Update WordPress themes
| name | version |
| twentytwelve | 4.0 |

@require-wp-4.5
Scenario: Not giving a slug on update should throw an error unless --all given
Given a WP install
And I run `wp theme path`
Expand Down
103 changes: 98 additions & 5 deletions features/theme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Feature: Manage WordPress themes
And STDOUT should be empty
And the return code should be 0

@require-wp-5.3
Scenario: Flag `--skip-update-check` skips update check when running `wp theme list`
Given a WP install

Expand All @@ -218,8 +219,8 @@ Feature: Manage WordPress themes

When I run `wp theme list --fields=name,status,update`
Then STDOUT should be a table containing rows:
| name | status | update |
| astra | inactive | available |
| name | status | update |
| astra | inactive | available |

When I run `wp transient delete update_themes --network`
Then STDOUT should be:
Expand All @@ -229,8 +230,8 @@ Feature: Manage WordPress themes

When I run `wp theme list --fields=name,status,update --skip-update-check`
Then STDOUT should be a table containing rows:
| name | status | update |
| astra | inactive | none |
| name | status | update |
| astra | inactive | none |

Scenario: Install a theme when the theme directory doesn't yet exist
Given a WP install
Expand Down Expand Up @@ -284,6 +285,7 @@ Feature: Manage WordPress themes
Theme updated successfully.
"""

@require-wp-5.7
Scenario: Enabling and disabling a theme
Given a WP multisite install
And I run `wp theme install moina`
Expand Down Expand Up @@ -379,6 +381,7 @@ Feature: Manage WordPress themes
And STDOUT should be empty
And the return code should be 1

@require-wp-5.7
Scenario: Install and attempt to activate a child theme without its parent
Given a WP install
And I run `wp theme install moina-blog`
Expand All @@ -392,6 +395,7 @@ Feature: Manage WordPress themes
And STDOUT should be empty
And the return code should be 1

@require-wp-5.7
Scenario: List an active theme with its parent
Given a WP install
And I run `wp theme install moina`
Expand Down Expand Up @@ -470,6 +474,7 @@ Feature: Manage WordPress themes
twentytwelve,1.0,{UPDATE_VERSION},Updated
"""

@require-wp-5.7
Scenario: Automatically install parent theme for a child theme
Given a WP install

Expand Down Expand Up @@ -579,7 +584,7 @@ Feature: Manage WordPress themes
Error: Parameter errors:
Invalid value specified for 'status' (Filter the output by theme status.)
"""

@require-wp-5.7
Scenario: Parent theme is active when its child is active
Given a WP install
And I run `wp theme delete --all --force`
Expand Down Expand Up @@ -620,3 +625,91 @@ Feature: Manage WordPress themes
Then STDOUT should be a table containing rows:
| auto_update |
| on |

Scenario: Show theme update as unavailable if it doesn't meet WordPress requirements
Given a WP install
And a wp-content/themes/example/style.css file:
"""
/*
Theme Name: example
Version: 1.0.0
*/
"""
And a wp-content/themes/example/index.php file:
"""
<?php
// Silence is golden.
"""

Given that HTTP requests to https://api.wordpress.org/themes/update-check/1.1/ will respond with:
"""
HTTP/1.1 200 OK

{
"themes": {
"example": {
"theme": "example",
"new_version": "2.0.0",
"requires": "100",
"requires_php": "5.6"
}
},
"translations": [],
"no_update": []
}
"""

And I run `wp theme list`
Then STDOUT should be a table containing rows:
| name | status | update | version | update_version | auto_update | requires | requires_php |
| example | inactive | unavailable | 1.0.0 | 2.0.0 | off | 100 | 5.6 |

When I try `wp theme update example`
Then STDERR should contain:
"""
Warning: example: This update requires WordPress version 100
"""

Scenario: Show theme update as unavailable if it doesn't meet PHP requirements
Given a WP install
And a wp-content/themes/example/style.css file:
"""
/*
Theme Name: example
Version: 1.0.0
*/
"""
And a wp-content/themes/example/index.php file:
"""
<?php
// Silence is golden.
"""

Given that HTTP requests to https://api.wordpress.org/themes/update-check/1.1/ will respond with:
"""
HTTP/1.1 200 OK

{
"themes": {
"example": {
"theme": "example",
"new_version": "2.0.0",
"requires": "3.7",
"requires_php": "100"
}
},
"translations": [],
"no_update": []
}
"""

And I run `wp theme list`
Then STDOUT should be a table containing rows:
| name | status | update | version | update_version | auto_update | requires | requires_php |
| example | inactive | unavailable | 1.0.0 | 2.0.0 | off | 3.7 | 100 |

When I try `wp theme update example`
Then STDERR should contain:
"""
Warning: example: This update requires PHP version 100
"""
1 change: 1 addition & 0 deletions features/upgradables.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Feature: Manage WordPress themes and plugins
Background:
Given an empty cache

@require-wp-4.5
Scenario Outline: Installing, upgrading and deleting a theme or plugin
Given a WP install
And I run `wp <type> path`
Expand Down
Loading