It looks like you're new here. If you want to get involved, click one of these buttons!
I'm finalizing some scripts to automate testing of Vanilla Plugins, but I stumbled upon an odd behaviour: if a plugin depends on another, enabling them one after the other via
EnablePlugin() doesn't work as expected. To be more specific, the following code will generate an error:
// This will work Gdn::PluginManager()->EnablePlugin('SomePlugin', $Validation); // This will not work if, while being enabled, the plugin uses anything from SomePlugin. // In my case, ChildPlugin uses SomePlugin, who, in turn, needs one of its models to carry // on. In such case, the error "Class not found" is returned Gdn::PluginManager()->EnablePlugin('ChildPlugin', $Validation);
If the same tests are run immediately after the first fail, they will succeed. In short:
phpunit sometests.php // This will fail with "class not found"
phpunit sometests.php // This will run correctly
It seems, to me, that
EnablePlugin() doesn't expose the plugin to the various classes until next bootstrap. However, this is a speculation, as I haven't found an explanation for such behaviour.
If anyone has any suggestion, it would be very welcome. Thanks.