Closed (fixed)
Project:
Mollom
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
22 Oct 2009 at 16:47 UTC
Updated:
6 Nov 2009 at 00:40 UTC
Jump to comment: Most recent file
Before I want to get to far in writing tests for #245682: Enable use of Mollom for any form, the tests needed a lot of cleanup that will make writing future tests easier and simpler.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 611860-mollom-test-revamp-D6.patch | 47.48 KB | dave reid |
Comments
Comment #1
dave reidThe major changes in the patch:
1. Adds private key, user, and message variables for the things that are re-used on 99% of tests.
2. Split mollomKeySetup() into setUpMollom(), setKeys() and assertValidKeys().
3. Adds assertCaptchaField() and assertNoCaptchaField() for re-use instead of having to do
$this->assertNoFieldById('edit-mollom-captcha', '', t('The CAPTCHA is absent on the request password form when the Mollom servers are unavailable.'));4. Added postCorrectCaptcha(), postIncorrectCaptcha(), assertSpamSubmit(), assertHamSubmit() and assertUnsureSubmit() as wrappers around drupalPost() and submitting captchas and spam/ham/unsure fields.
5. Removed the mollomSetAdminOptions(). Not consistant with how we do tests. If we need to test the admin screen, we should do that in our tests. If we need to quick set one variable, we should call variable_set() directly.
6. The only change in MollomResellerTestCase looks big, but all it does it change the logic of checking if the keys are resellers to return instead of putting the tests inside the if statement.
So when re-using these fuctions we get the same test coverage with only 361 assertions instead of 513 (pre-patch).
Comment #2
dave reidI'll probably find more cleanups but I'd rather get this in and then back to the form code.
Comment #3
dries commentedThis looks like a great clean-up. Committed to DRUPAL-6 HEAD.