-
Notifications
You must be signed in to change notification settings - Fork 40
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
Fixed: Undefined property originalLanguageDefault
in simpletest.
#4679
Comments
Drupal 7 defines it as such: In Backdrop this variable can get accessed with |
Here's a PR which sets originalLanguageDefault in function prepareEnvironment(). |
Is the code that is using this doing something that makes sense now? Isn't $GLOBALS['conf'] a Drupal thing - old style variable_set()? The original code was checking the config
and then restoring that value if there was one, but it wasn't restoring it to the config. I don't know if test code like this
is affecting the actual config files of the installation, and so needs a config_set() to put it back? |
Yes, I think so. The purpose of originalLanguageDefault is not to fiddle with the actual config files, but to restore the global in $conf back to the original in function tearDown, in case it has been changed. (Backdrop and Drupal 7 globals are mostly the same.) language_default() does the same as config_get('system.core', 'language_default'), but with a static cache and a fallback. |
That's what I'm saying, though. For one, there is no global $conf. That's Drupal variables. For another, the original code that created this line was only setting it if it had found a value in the system.core config. It returned it to the status quo. Are the config changes made in tests affecting the actual config of the site? Or only the copies? If it's not changing the real system.core config, then isn't the simplest thing to remove this altogether? |
There it is: https://api.backdropcms.org/api/backdrop/core%21authorize.php/global/conf/1 See also: https://api.backdropcms.org/api/backdrop/core%21includes%21drupal.inc/group/drupal_compatibility/1
Simpletest does not change any real config files. The global $conf is available in all scopes throughout a script, which is probably the reason, why it's reset after running tests. |
I think it ends up "restoring" values that weren't there to begin with, and it would be fine to remove these lines altogether. Otherwise, I think it's simpler to just add |
@indigoxela if the simple one-liner fixes this problem here, then I would like us to get it in, to get another thing out of the way. Can you please rebase your PR? |
I have tried the STR from the issue summary:
I'm tentatively marking this as WFM, pending rebase in order to mark it RTBC. |
Rebased, and tests are ... "passing". |
I've read all the comments and I didn't feel there was consensus on the fix. I'm not clear on any implications. It looks like an easy fix but it's confusing how the different things were added and removed around this. @bradbulger and @indigoxela do you think you'd come to agreement on the fix here? |
@herbdool |
@indigoxela sorry I'm still a bit confused. This issue is about originalLanguageDefault but you linked to checkPath. |
You are absolutely right, another example of "read before you post" - sorry about the confusion. (Same person, different issue.) If you have concerns, you maybe better ask @bradbulger - I just provided the bugfix. It they think, this requires further discussion, then maybe I'll just close my PR to make space for alternate approaches. |
@indigoxela please keep your PR open. It might be the best one here but it wasn't clear to me based on your discussion above. I investigated a bit @bradbulger's concerns too but nothing conclusive. |
I've got a PR removing |
Strange, there's a test failure in CommentApprovalTest with php 7.4:
Could this be related to that change? |
I did a quick local check, running only that test on php 7.4. It passes locally, so probably the failure is unrelated. @herbdool can you please close and reopen the PR to verify (or, if you have permission, just re-run the workflow)? That test used to be one of the random failures, but got fixed years ago. |
@indigoxela thanks, I didn't know I had permissions to rerun the tests. I've just done so. |
@indigoxela looks like it was just a random failure |
Tested per original instructions: worked to suppress the dblog entries. WFM. Code reviewed. Looks good. RTBC. |
…leTest tearDown(). By @herbdool, @bradbulger, @indigoxela, @quicksketch, @klonos, and @bugfolder.
…leTest tearDown(). By @herbdool, @bradbulger, @indigoxela, @quicksketch, @klonos, and @bugfolder.
Thanks! I merged backdrop/backdrop#3825 into 1.x and 1.20.x. Props to @herbdool, @bradbulger, @indigoxela, @klonos, and @bugfolder for their work on this issue! |
originalLanguageDefault
in simpletest.
In backdrop_web_test_case_cache.php, the tearDown() function of BackdropWebTestCaseCache refers to an originalLanguageDefault property. That property is not defined.
It's a little murky. It was originally added to BackdropWebTestCase by the fix to #1835. Then in issue #2776, a fix to the Drupal issue 1823504 was applied, and that ended up removing the property. I think maybe only because it had moved? Or something else inadvertent.
This matters because I wonder if the proper fix is to restore some of the changes from #1835.
You can see this by running SimpleTestBrokenSetUp ("Broken SimpleTest method") and displaying errors and/or checking the error log.
How to reproduce
Actual result
There are three dblog entries with:
Notice: Undefined property: BackdropWebTestCaseCache::$originalLanguageDefault in BackdropWebTestCaseCache->tearDown() (line 160 of .../core/modules/simpletest/backdrop_web_test_case_cache.php).
The text was updated successfully, but these errors were encountered: