The setUp method currently doesn't check if module_enable($modules) returns true or not. Patch forthcoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhedstrom’s picture

Status: Active » Needs review
FileSize
604 bytes
jhedstrom’s picture

Issue tags: +Usability

Adding 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).

catch’s picture

Category: bug » task
Issue tags: +Needs tests

We 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.

jhedstrom’s picture

Writing 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.

catch’s picture

I meant writing a test for simpletest itself - it should be possible to assert the assertion.

catch’s picture

Although 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().

jhedstrom’s picture

Hadn'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.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Nice.

jhedstrom’s picture

Issue tags: +Needs backport to D7

Adding 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.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Neat! I had somehow forgotten about assertAssertion(). :)

Committed to 8.x and 7.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.