File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
Expand file tree Collapse file tree 3 files changed +36
-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,19 @@ 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+ Scenario: Using a non-lowercase slug should not find a theme
522+ Given a WP install
523+
524+ When I try `wp theme activate TwentySixteen`
525+ Then STDOUT should be empty
526+ And STDERR should contain:
527+ """
528+ The 'TwentySixteen' theme could not be found.
529+ """
530+
531+ When I run `wp theme activate twentysixteen`
532+ Then STDOUT should be:
533+ """
534+ Success: Switched to 'Twenty Sixteen' theme.
535+ """
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