Feature: Install WordPress plugins Scenario: Branch names should be removed from Github projects Given a WP install When I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/archive/refs/heads/master.zip --activate` Then STDOUT should contain: """ Downloading install """ And STDOUT should contain: """ package from https://github.com/wp-cli-test/generic-example-plugin/archive/refs/heads/master.zip """ And STDOUT should contain: """ Renamed Github-based project from 'generic-example-plugin-master' to 'generic-example-plugin'. """ And STDOUT should contain: """ Plugin installed successfully. """ And the wp-content/plugins/generic-example-plugin directory should exist And the wp-content/plugins/generic-example-plugin-master directory should not exist When I try `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/archive/refs/heads/master.zip` Then STDERR should contain: """ Warning: Destination folder already exists """ Then STDERR should contain: """ Error: No plugins installed. """ And the wp-content/plugins/generic-example-plugin directory should exist And the wp-content/plugins/generic-example-plugin-master directory should not exist And the return code should be 1 When I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/archive/refs/heads/master.zip --force` Then STDOUT should contain: """ Plugin updated successfully. """ And the wp-content/plugins/generic-example-plugin directory should exist And the wp-content/plugins/generic-example-plugin-master directory should not exist # However if the plugin slug ('modern-framework') does not match the project name then it's downloaded to wrong directory. When I run `wp plugin install https://github.com/Miller-Media/modern-wordpress/archive/master.zip` Then STDOUT should contain: """ Plugin installed successfully. """ And STDOUT should match /Renamed Github-based project from 'modern-(?:wordpress|framework)-master' to 'modern-wordpress'/ # Wrong directory. And the wp-content/plugins/modern-wordpress directory should exist And the wp-content/plugins/modern-framework directory should not exist Scenario: Don't attempt to rename ZIPs uploaded to GitHub's releases page Given a WP install When I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/releases/download/v0.1.0/generic-example-plugin.0.1.0.zip` Then STDOUT should contain: """ Plugin installed successfully. """ And STDOUT should not contain: """ Renamed Github-based project from 'generic-example-plugin-0.1.0' to 'generic-example-plugin'. """ And the wp-content/plugins/generic-example-plugin directory should exist Scenario: Don't attempt to rename ZIPs coming from a GitHub raw source Given a WP install When I run `wp plugin install https://github.com/Miller-Media/modern-wordpress/raw/master/builds/modern-framework-stable.zip` Then STDOUT should contain: """ Plugin installed successfully. """ And STDOUT should not contain: """ Renamed Github-based project from 'modern-framework-stable' to 'modern-framework'. """ And the wp-content/plugins/modern-framework directory should exist Scenario: Installing respects WP_PROXY_HOST and WP_PROXY_PORT Given a WP install And a invalid-proxy-details.php file: """