-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Fatal error: Class 'Craft' not found" when running tests on CircleCI #5164
Comments
Do these tests run locally? Also what does your |
Yes, they run properly in the local Docker environment I use for development.
<?php
use craft\test\TestSetup;
return TestSetup::createTestCraftObjectConfig();
<?php
use craft\test\TestSetup;
ini_set('date.timezone', 'UTC');
// Use the current installation of Craft
define('CRAFT_STORAGE_PATH', __DIR__ . '/_craft/storage');
define('CRAFT_TEMPLATES_PATH', dirname(__DIR__) . '/templates');
define('CRAFT_CONFIG_PATH', __DIR__ . '/_craft/config');
define('CRAFT_MIGRATIONS_PATH', __DIR__ . '/_craft/migrations');
define('CRAFT_TRANSLATIONS_PATH', __DIR__ . '/_craft/translations');
define('CRAFT_VENDOR_PATH', dirname(__DIR__).'/vendor');
TestSetup::configureCraft(); |
Hmm that looks all normal. If you can share your |
# Codeception Test Suite Configuration
#
# Suite for unit or integration tests.
actor: UnitTester
modules:
enabled:
- \craft\test\Craft
- Asserts
- \Helper\Unit
step_decorators: ~ # Codeception Test Suite Configuration
#
# Suite for functional tests
# Emulate web requests and make application process them
# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it
# Remove this suite if you don't use frameworks
actor: FunctionalTester
modules:
enabled:
- \craft\test\Craft
- \Helper\Functional
step_decorators: ~ |
Yeah, it's bewildering. My first thought was some kind of case sensitivity issue going from macOS to Linux, but since I'm running in Docker locally, I think I've squashed all of those issues. |
Looks like it's related to your codeception version. You are using See the discussion around #4772 - Craft's Travis CI ran into the same problem. Can you try adding |
@gtettelaar this does appear to have fixed the issue. Thanks for all your help! I can go ahead and close this out unless you or someone on the team would prefer to. |
@dce Good to hear! Went ahead and closed it for you. @angrybrad Do you have an idea of how through for example composer to require a minimum of |
@gtettelaar hrm... not sure. We started requiring Codeception 3.1 since Craft 3.3.1, so I'm assuming this was an upgraded install from pre 3.3.1. A bit hacky, but maybe we could do some Codeception version number checking in our test config/bootstrap and bail if it's pre 3.1 with a message saying to update? |
@angrybrad help out a cross-fields refugee. What is 'hacky' about such a decent check?? Trying to understand meaning of that term...srsly |
@angrybrad Yea but
The testing framework ( |
@angrybrad Brad, never mind -- it's Monday and we are all busy. It is a sort of recurring question, though, if of course I probably understand one or more answers. Not everything being solvable by elegant algorithmic patterns, up front ... 😎🐟 |
@angrybrad What about Composer's conflict option? |
@gtettelaar possible as a workaround... i've never used that before. Outside of @narration-sd hacky was probably the wrong word. more like not the most desirable option. |
@gtettelaar from the peanut gallery, The downside may be that you'd get one of those 'something doesn't match your conditions' null-reports from Composer, where the scripted block would report very clearly. I guess you'll find best by trying it. And I will keep quiet! But interested. @angrybrad ++thanks, Brad |
Just thinking about it - this bug is really caused by Codeception. If you configure it incorrectly (use I'll PR a 'fix' for the docs to make this more explicit but I don't see a nice way of solving this without jumping through hoops that worsen the codebase in an effort to fix an edge case. Honestly, the few people running into this will probably find this issue and the problem will be resolved for them. Regarding |
@gtettelaar cool, agreed about the edge-casiness. I think given enough time this will sort of work itself out, anyway. |
Description
I have a test suite that runs in my local Docker environment, and I'm trying to get it running on CircleCI. Trouble is, no matter what I try, I get some variant of this error:
The issue seems connected to the references to
craft\test\Craft
incodeception.yml
,test/functional.suite.yml
andtest/unit.suit.yml
-- if I remove those, the error goes away (and new ones appear, of course).This is almost certainly an issue with my code/config and not Craft, but I'm curious if anyone else has encountered anything like this. Thank you.
Steps to reproduce
.circleci/config.yml
:codeception.yml
Not sure what other info is relevant but happy to provide anything.
Additional info
The text was updated successfully, but these errors were encountered: