Running Codeception for all tests the Craft Edition defaults to Solo before overriding project configuration
Open
@angrybrad is already working on this.
Since Mar 25, 2021.
bug
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Description
When running codeception run for my plugin I encounter an issue when running tests.
In ApplicationTrait.php line 490:
Craft Pro is required for this
I traced the stack back through to the following event and the issue during the saveUserGroup function. Which I would expect if the Edition of Craft is set to Solo.
In my project configuration I have set the version to Pro but these settings don't seem to persist at this point. The full event I am trying to run is attached below:
Event::on(
Plugins::class,
Plugins::EVENT_AFTER_INSTALL_PLUGIN,
function (PluginEvent $event) {
if ($event->plugin === $this) {
// We were just installed
$magicLoginUserGroup = new UserGroup();
$magicLoginUserGroup->name = 'Magic Login';
$magicLoginUserGroup->handle = 'magicLoginHandle';
$magicLoginUserGroup->description = Craft::t('magic-login', 'Users within this group were registered with magic login capabilities.');
$groupSaved = Craft::$app
->getUserGroups()
->saveGroup($magicLoginUserGroup);
if (!$groupSaved) {
Craft::error(Craft::t('magic-login', 'Could not create Magic Login User group.'), __METHOD__);
}
Craft::info(Craft::t('magic-login', 'Created Magic Login User Group.'), __METHOD__);
}
}
);
Steps to reproduce
- Pull the code from the plugin here: https://github.com/creode/magic-login/tree/feature/40-user_groups_broken
- Composer install to install dependencies.
Run vendor/bin/codecept runto run the test suite. An error about the Craft Version should appear even though the project config sets the version to be Pro.
Additional info
- Craft version: 3.6.11
- PHP version: 7.3.27
- Database driver & version: mysql (MariaDB 10.5.9)
- Plugins & versions: Magic Login (attached above) - 1.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.