File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -80,3 +80,17 @@ Feature: Activate WordPress plugins
8080 """
8181 Success: No plugins installed.
8282 """
83+
84+ Scenario : Using a non-lowercase slug should not find a plugin
85+ When I try `wp plugin activate Akismet`
86+ Then STDOUT should be empty
87+ And STDERR should contain:
88+ """
89+ The 'Akismet' plugin could not be found.
90+ """
91+
92+ When I run `wp plugin activate akismet`
93+ Then STDOUT should contain:
94+ """
95+ Plugin 'akismet' activated.
96+ """
Original file line number Diff line number Diff line change @@ -517,3 +517,20 @@ Feature: Manage WordPress themes
517517 """
518518 Error: Can't find the requested theme's version 1.4.2 in the WordPress.org theme repository (HTTP code 404).
519519 """
520+
521+ @require-wp-4.4
522+ Scenario: Using a non-lowercase slug should not find a theme
523+ Given a WP install
524+
525+ When I try `wp theme activate TwentySixteen`
526+ Then STDOUT should be empty
527+ And STDERR should contain:
528+ """
529+ The 'TwentySixteen' theme could not be found.
530+ """
531+
532+ When I run `wp theme activate twentysixteen`
533+ Then STDOUT should be:
534+ """
535+ Success: Switched to 'Twenty Sixteen' theme.
536+ """
Original file line number Diff line number Diff line change @@ -14,11 +14,16 @@ class Theme extends Base {
1414
1515 /**
1616 * Get a theme object by name
17- *
17+ *
1818 * @param string $name
1919 * @return object|false
2020 */
2121 public function get ( $ name ) {
22+ // To avoid later issues, we force slugs to be lowercase.
23+ if ( strtolower ( $ name ) !== $ name ) {
24+ return false ;
25+ }
26+
2227 $ theme = wp_get_theme ( $ name );
2328
2429 if ( !$ theme ->exists () ) {
You can’t perform that action at this time.
0 commit comments