-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Test fixes from 4.4.2 to 5.x merge #11476
Conversation
Codecov Report
@@ Coverage Diff @@
## 4.4 #11476 +/- ##
=========================================
Coverage 49.36% 49.37%
Complexity 35401 35401
=========================================
Files 2144 2144
Lines 105532 105532
=========================================
+ Hits 52101 52102 +1
+ Misses 53431 53430 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix is good to solve the seen issue.
I still don't get how the MAUTIC_ENV
change is needed, as
SYMFONY_ENV
is set and will be used to setMAUTIC_ENV
if not defined (see https://github.com/mautic/mautic/blob/5.x/app/AppKernel.php#L38)- the
\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase::createKernel()
defaults totest
, which will create the AppKernel with thetest
environment - the
\AppKernel::getCacheDir()
uses the environment to determine the cache dir. - Mautic console depends on the
SYMFONY_ENV
var to determine the environment, see https://github.com/mautic/mautic/blob/5.x/bin/console#L29 - the content of the
.env
and.env.dist
files is correct
So even is there is logic that would boot mautic with the wrong env, it would only fill up the cache for the wrong env.
PHPUnit will alwas use the test env (unless defined otherwise, but this isn't the case)
I may dive deeper to really understand this issue, as we can't reproduce this on 4.x or local, and there is no substantial change in 5.x branch that can explain this.
It looks like there is an external factor (github action, ...) that results in this funky situation.
But as this solves this weird situation, I don't see any issue merging this.
Description:
#11196 added dynamic table prefix to the tests for a good reason. However, it means that the cache must be cleared before every test execution. A developer can run test(s) many times per day and building the cache takes tens of seconds. That means it's a big lose of time.
This PR changes it to static prefix which can be defined by .env(.dist) file or by defining env var in the phpunit command execution itself. There is small chance that the developer uses the same table prefix on local, production and test environment so the problem with hard-coded prefixes should be discovered in some environment.
We had problem in #11438 that the CI tests were still failing even after the static table prefix. So this PR also contains unified loading of the env file and setting
MAUTIC_ENV=test
in the CI which actually fixed the issue as after that the config_test.php was properly loaded.Steps to test this PR: