xwp / wp-dev-lib

DEPRECATED. Common code used during development of WordPress plugins and themes
MIT License
279 stars 58 forks source link

Retrieve plugin file to load from environment #307

Closed pierlon closed 5 years ago

pierlon commented 5 years ago

This allows a custom plugin file to be specified. Solves edge cases where the incorrect plugin file is loaded when multiple plugin files are present.

derekherman commented 5 years ago

Thank you @pierlon, what was the reason for the force push? Can you describe how this would be used in the wild. Why would a plugin have two plugin files? That would be an issue with Core as well.

pierlon commented 5 years ago

what was the reason for the force push

I missed a line:

https://github.com/xwp/wp-dev-lib/blob/e1f26eebfa34e7cb467c590cfc793fc63cb0af40/sample-config/phpunit-plugin-bootstrap.php#L25

Should I instead make a new commit with the fix and squash on merge?


Why would a plugin have plugin files

In our case, we would like to add a plugin to WP AMP for the ability to opt-in to beta updates, and putting it alongside the main plugin file would be the most logical option (see https://github.com/ampproject/amp-wp/pull/3560). Having more than one plugin file in the same folder no longer guarantees that the correct plugin file will be loaded.

kasparsd commented 5 years ago

@pierlon Could you please check if this suggestion would work for your setup -- to extend the list of plugins loaded via WP_TEST_ACTIVATED_PLUGINS instead.

pierlon commented 5 years ago

Much thanks @kasparsd :+1: .