Closed (fixed)
Project:
Scheduler
Version:
7.x-1.x-dev
Component:
Testing
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Sep 2023 at 13:50 UTC
Updated:
28 Nov 2024 at 14:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
jonathan1055 commentedIt seems like testing with Drupal 7 on GitLab CI is not yet ready
#3343810: Support for testing Contrib Drupal 7 with the template
Comment #4
jonathan1055 commentedComment #6
jonathan1055 commentedPatch for core debug.
Comment #8
jonathan1055 commentedBreakthrough! I removed the 'date' and 'date_pop' modules from the Date test, and the Scheduler permissions were then properly available. It was an obvious thing to try, in hindsight, but things are always simple afterwards. Clearly this is not the solution, because the tests now fail due to not having the Date module. But we can now investigate what Date is doing.
Here's a sample from the extra debug, when the Date module is enabled. It seems that Scheduler is known about in module_list() but then it becomes unknown.
From this point onwards, module_list never returns 'scheduler' so the permissions are not returned, even though the module is konwn, enabled and we get
function scheduler_permission existsin the debug log.Comment #9
fjgarlin commentedThis is great! Sometimes it's the most unexpected!
Comment #10
fjgarlin commentedTrying patch from #2763435: Exceptions during the setUp() or tearDown() method of a test are not handled. The rendered markup comes because even if "parent::setUp" triggered an error, the "test..." method is still trying to be run. It just doesn't seem to be stopping on fail.
Comment #11
jonathan1055 commentedThanks for finding that issue and patching it here. Your commits dont seem to be triggering pipelines.
Comment #12
fjgarlin commentedI thinkI identified the source of the main issue (html thrown and errors reported as success). Will explain further tomorrow but you can see how everything looks "as it should" in the last pipeline: https://git.drupalcode.org/issue/scheduler-3387331/-/pipelines/28836Hint: PHP5.6 vs PHP7 handle the same error in different ways.
Comment #13
fjgarlin commentedThe fix for core is here: #3393147: Exceptions ignored in errorHandler for DrupalTestCase.
With this patch applied, you should be able to at least catch the exception when it happens and it won't try anything else or report a false positive.
There is still the issue of the permissions not being available, but that seems to be related to a combo of date, date_popup, scheduler as mentioned in #8.
I left the file "drupal_web_test_case.php" in the MR and commented out the patch with the additional output you did. I find that way easier to override things from core. Bring the file to the repo, change it at will and then override the core one via GitlabCI. That way you don't need to generate patches. In any case, that's what works for me but you can continue however it's easier for you.
Comment #14
jonathan1055 commentedThis is excellent progress, thanks for taking it on.
Yes, that's a separate problem. I'm going to take that on to a new MR, and leave this MR to demonstrate the problem and fix for tests not failing.
That's also a good way to do it. I'm happy to leave it like this.
I'm going to change the tests here, to just run two simple tests to demonstrate the problems of not failing. Hopefully these should both fail with your patch. First run will be without the patch, which should pass (incorrectly).
Comment #15
fjgarlin commentedFor the parse error, you might actually be able to catch it (https://stackoverflow.com/questions/1900208/php-custom-error-handler-han...). Maybe playing with "shutdown" functions, but not sure how, and if possible, it'll be something to add to core D7, similar to the other issue we found.
Drupal has "drupal_register_shutdown_function" function.
Comment #16
jonathan1055 commentedJust to record this here, with core patched from the commit on #3393147: Exceptions ignored in errorHandler for DrupalTestCase, the
login(false)exception now causes the test to failhttps://git.drupalcode.org/project/scheduler/-/pipelines/29134
Comment #17
jonathan1055 commentedRestoring this mr to contain the syntax error test. For following up the hints in #15.
Comment #18
jonathan1055 commentedThanks to @flgarlin's work on #3392363: D7 contrib pipeline tests fail when requiring a 3rd-party contrib module Scheduler no longer has move the loaded modules #3401828: Remove custom composer after_script
So this is now fixed.