inpsyde / modularity

A PSR-11 implementation for WordPress Plugins, Themes or Libraries.
https://inpsyde.github.io/modularity/
GNU General Public License v2.0
44 stars 4 forks source link

Fix plugin active state detection #29

Closed shvlv closed 1 year ago

shvlv commented 1 year ago

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) Bug fix.

What is the current behavior? (You can also link to an open issue here) The \Inpsyde\Modularity\Properties\PluginProperties::isActive and \Inpsyde\Modularity\Properties\PluginProperties::isNetworkActive methods don't work as expected because their arguments should be the path to the plugin file relative to the plugins directory (not absolute path).

What is the new behavior (if this is a feature change)? New private property pluginBaseName was introduced to use with is_plugin_active and is_plugin_active_for_network WordPress functions. I don't know do we need the getter for the property.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?) No.

Other information: I targeted my previous PR because it's partially related. But it could be separated if needed.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change

Comparison is base (602a940) 96.88% compared to head (218d83b) 96.88%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## feature/plugin-main-file #29 +/- ## =========================================================== Coverage 96.88% 96.88% Complexity 178 178 =========================================================== Files 9 9 Lines 513 513 =========================================================== Hits 497 497 Misses 16 16 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `96.88% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=inpsyde#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/inpsyde/modularity/pull/29?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=inpsyde) | Coverage Δ | | |---|---|---| | [src/Properties/PluginProperties.php](https://codecov.io/gh/inpsyde/modularity/pull/29?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=inpsyde#diff-c3JjL1Byb3BlcnRpZXMvUGx1Z2luUHJvcGVydGllcy5waHA=) | `93.47% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=inpsyde). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=inpsyde)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.