Conversation
|
Probably helps if I commit the new plugin that the tests are targeting |
|
As a note, I've added some consts for plugin count in the |
|
@jaxwilko are you sure this fixes the issue, though? I don't see the link with |
|
@mjauvin the replacement map correctly stores normalized identifiers The normalized map also correctly stores lower keys to normalized identifiers The issue is when you normalize an identifier via |
|
But this line will never return true for a replaced plugin: |
|
Expanding on the above, when you call |
|
Oh, I get it now... but you still need to use the plugin name with the exact capitalization, otherwise it won't work... this is not true for the replacement plugin, though |
The reason for this is we don't know the true normalized identifier for the plugin being replaced, so we just take whatever the replacement plugin suggests, if a developer accidentally provides: It is down to the plugin developer to correctly implement the replacement, they should notice when testing that the plugin wont be flagged as replaced if they mistype. |
vs |
But why don't we put everything as lowercase internally, and always normalize the provided identifiers for any of the methods? |
|
@mjauvin honestly that's what I'd prefer to do, we have to transform everything everywhere and it doesn't make much sense doing that. Would be really nice to just Re: mixed casing But I really don't like it |
|
What's wrong with: diff --git a/modules/system/classes/PluginManager.php b/modules/system/classes/PluginManager.php
index f2ba9cdbb..73a88c651 100644
--- a/modules/system/classes/PluginManager.php
+++ b/modules/system/classes/PluginManager.php
@@ -180,7 +180,7 @@ class PluginManager
$replaces = $pluginObj->getReplaces();
if ($replaces) {
foreach ($replaces as $replace) {
- $this->replacementMap[$replace] = $classId;
+ $this->replacementMap[$this->getNormalizedIdentifier($replace)] = $classId;
}
} |
|
I think that would work with the pervious version of We could revert back to the old version of @LukeTowers any thoughts? |
|
I've marked this as a draft because while it resolves issues reported in #575 it adds in a lot of complexity with how we handle things internally. This PR is more of a hack than a real fix at this time. A proper solution would be to convert the internals of |
This modifies the plugin manager to internally treat plugin identifiers as lower case strings, only transforming them to their normalized versions when requested by methods like getPlugins() & getAllPlugins(). The idea behind this is that it provides a much simpler way to internally handle checking, especially for plugin replacement where casing could cause issues. Replaces #576. Fixes #575.
|
Closing in favour of fba6446 |
This splits the testing suite into the separate modules as appropriate in order to improve the reliability of the testing suite as a whole and make it easier for developers to have an up to date testing suite from the core to build off of. Additionally the tests are now namespaced and some minor improvements to the PluginManager were made. Now the PluginManager will internally treat plugin identifiers as lower case strings, only transforming them to their normalized versions when requested by methods like getPlugins() & getAllPlugins(). The idea behind this is that it provides a much simpler way to internally handle checking, especially for plugin replacement where casing could cause issues. Replaces #576. Fixes #575.




This PR resolves the issue raised in #575.
Simply it ensures that
normalizeIdentifier()returns the value passed if the key is not found in thenormalizedMaparray.