Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The setUp method currently doesn't check if module_enable($modules) returns true or not. Patch forthcoming.
Comment | File | Size | Author |
---|---|---|---|
#7 | drupal-simpletest-1171436-07.patch | 2.62 KB | jhedstrom |
#1 | drupal-simpletest-1171436-01.patch | 604 bytes | jhedstrom |
Comments
Comment #1
jhedstromComment #2
jhedstromAdding the 'Usability' tag, as that is what this issue comes down to. Without this assertion, when a dependent module isn't available, the test results are confusing and mis-leading (for example, the first fail will be something such as 'permission foo' not found).
Comment #3
catchWe should add something to the simpletest tests to confirm this actually works. Also this is a task rather than a bug, but looks like a good addition.
Comment #4
jhedstromWriting tests (eg, calling parent::setIp with bogus modules and expecting a test failure), will most likely require some version of #301005: Add "expected fail" functionality to simpletest.
Comment #5
catchI meant writing a test for simpletest itself - it should be possible to assert the assertion.
Comment #6
catchAlthough I haven't looked at the simpletests for simpletest for ages so that might not be possible. Another option would just be to upload a patch that passes without this patch applied, and fails with it, then we could postpone reall tests on expectedFail().
Comment #7
jhedstromHadn't realized simpletest did assertAssertion. Here's a patch with an added test in simpletest.test. The fake module is called 'non_existent_module', which the test tries to enable during setUp.
Comment #8
catchNice.
Comment #9
jhedstromAdding the 'needs backport to D7' tag because this causes very frustrating issues when trying to run simpletests from contrib that require a variety of other modules to run.
Comment #10
webchickNeat! I had somehow forgotten about assertAssertion(). :)
Committed to 8.x and 7.x. Thanks!