You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to write Unit Tests for my plugin, following the Codeception/_bootstrap.php approach like is done in the Grav repo, if I try and get a user before every test:
I did a little digging, and it seems that the AccountsServiceProvider.php is blindly defining a constant and not checking if it first exists.
This is fine when your PHP process instantiates Grav once, but when trying to write unit tests and reinstantiating Grav multiple times, it means only the first test will pass and all the rest will throw an error due to $this->grav['accounts']->load in the _before() function trying to redefine a constant.
I believe a simple fix would be wrapping them in a check within AccountsServiceProvider.php like so:
if (!defined('GRAV_USER_INSTANCE')) {
define('GRAV_USER_INSTANCE', 'DATA');
}
The text was updated successfully, but these errors were encountered:
When trying to write Unit Tests for my plugin, following the Codeception/
_bootstrap.php
approach like is done in the Grav repo, if I try and get a user before every test:Then it throws an error:
I did a little digging, and it seems that the AccountsServiceProvider.php is blindly defining a constant and not checking if it first exists.
This is fine when your PHP process instantiates Grav once, but when trying to write unit tests and reinstantiating Grav multiple times, it means only the first test will pass and all the rest will throw an error due to
$this->grav['accounts']->load
in the_before()
function trying to redefine a constant.I believe a simple fix would be wrapping them in a check within
AccountsServiceProvider.php
like so:The text was updated successfully, but these errors were encountered: