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
Injection Inception, Change #6: Final cleanup of test environment setup #8027
Conversation
3c8399b
to
0453aaf
Compare
After merging, QueuedTracking will have to be modified, as it still uses the TestingEnvironment.addHooks event. |
Looks like this PR depends on #8026, there are some odd access related failures. Waiting for that one. |
} | ||
} | ||
|
||
private function getExtraDefinitionsFromManpulators() |
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.
typo: getExtraDefinitionsFromManpulators
-> getExtraDefinitionsFromManipulators
Coming back again on the topic of "environment manipulators": the interface comment says:
So if I understand correctly:
If that's correct then maybe Regarding That would avoid the custom definition source + this custom code for tests in the ContainerFactory |
We could just have one, I was hoping an array would look like less of a hack. As for the interface, I think it's a good idea to keep it. Otherwise, Environment.php would reference a test file, namely the environment manipulator I added. I don't think application code should do that if possible.
Where would this be done? Would we be able to override the vars in Note: It would only avoid the lines that add the definition source. |
I'm not sure. But since the testing env manipulator does provide container entries to the environment (e.g. the entries defined in fixtures or test classes), it could also provide those entries through an array instead of a custom definition source? Maybe it's not possible, I was deep into the code yesterday but now I'm out of it and maybe it doesn't happen at the same time… For the interface I'm OK to keep it I see your point with coupling the core code to test code, for the array of env manipulators I would say let's turn it into a single dependency it's that's ok with you? I'd rather keep this core code as simple as we can so that it's easy to understand |
…ddHooks() to a new EnvironmentManipulator. Remove MakeGlobalSettingsWithFile since it is now redundant.
…tingEnvironmentVariables::addHooks().
…le to TestingEnvironmentManipulator.
It's not easily possible it seems. Using a definition source, we can return null for variables that don't exist in the json file. Can't do that if we just add the variables in an array. |
…ve Piwik_MockAccess since it is no longer used.
…is in earlier commit when adding PIWIK_TEST_MODE detection).
…those variables can be easily overridden by test classes through provideContainerConfig(BeforeClass).
…n Environment.php.
…r. Add hook in EnvironmentManipulator to get extra environment names, and specify test environment this way instead of through detecting PIWIK_TEST_MODE.
…nvironmentManipulator instead of in ContainerFactory.php.
…omparison tests require them (for now).
Ready for another review. |
Looks good to merge, except for the the Travis build: 2 failures in SystemTests: https://travis-ci.org/piwik/piwik/jobs/65642678#L524 Is it the random failure or something else? |
Ah those are queued tracking errors, I have to modify the plugin... |
QueuedTracking PR: matomo-org/plugin-QueuedTracking#8 The build won't pass, there's one failure left. I tried to fix it, but can't seem to figure out what the problem is. |
Injection Inception, Change #6: Final cleanup of test environment setup. Remove TestingEnvironment.addHooks event, make sure core doesn't depend on test files/classes/constants, integrate test environment variables w/ DI for easier overriding in tests, and related clean ups to test environment setup.
This PR is based off of #8008
Changes:
$loadTranslations
(handled byTestingEnvironmentVariables.