-
Notifications
You must be signed in to change notification settings - Fork 824
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
Enhancements required for linkfield migration #11171
Enhancements required for linkfield migration #11171
Conversation
This seems a bit odd - introducing a property with no way to change its value, then using reflection in the linked pull request. Why not add a setter for this? If it’s just for semver reasons, I’d rather we broke that convention than hacked in code like this. If we can’t, then could we introduce a |
This is literally only for use in unit tests. There is no valid use case for using this outside of unit tests, and by not adding a setter usage outside of tests is discouraged. A setter also becomes public API, which means we have to maintain BC for it afterward, which is not what we want for something that is only for use in testing. Same with environment variables. |
src/Core/Environment.php
Outdated
/** | ||
* Used by unit tests to override `isCli()` | ||
* @internal | ||
*/ | ||
private static ?bool $cliOverride = null; |
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.
/** | |
* Used by unit tests to override `isCli()` | |
* @internal | |
*/ | |
private static ?bool $cliOverride = null; | |
/** | |
* Used by unit tests to override `isCli()` | |
* This is not config, so use reflection to change the value | |
* @internal | |
*/ | |
private static ?bool $isCliOverride = null; |
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.
Done
src/Core/Environment.php
Outdated
if (self::$cliOverride !== null) { | ||
return self::$cliOverride; |
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.
if (self::$cliOverride !== null) { | |
return self::$cliOverride; | |
if (self::$isCliOverride !== null) { | |
return self::$isCliOverride; |
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.
Done
130aeb2
to
1879bce
Compare
I have added JOIN support for |
1879bce
to
faab576
Compare
* ENH Add lightweight test override for Environment::isCli() * NEW Allow JOIN with SQL UPDATE.
Commit 1: Adds a test utility. Required for a test in silverstripe/silverstripe-linkfield#244
Commit 2: Adds JOIN support for
SQLUpdate
. Required for migrating owners in silverstripe/silverstripe-linkfield#244Issue