We need to test the "Most recent poll" block provided by the poll module.

Suggested assertions:
- Make sure the block appears after being enabled on the admin/build/blocks page.
- Make sure the block actually shows the most recent poll (create several in order to verify).
- Make sure nothing appears if there are no polls in existence.

Comments

Alpheus’s picture

Category: bug » feature
Priority: Critical » Normal
Status: Active » Needs review
StatusFileSize
new2.28 KB

A patch containing the test for the most recent poll block.

NOTE: On the last run it didn't clean up after itself and it can potentially harm an exisiting drupal instance (Possible database caching issue)

cwgordon7’s picture

Status: Needs review » Needs work

No trailing spaces; don't use the 'public' declaration, for consistency; getInfo() keys should be on their own lines; otherwise looks good, though.

Alpheus’s picture

Had some last-minute problems with my laptop so I had to use another one, I didn't check for all the editor settings; the keyword declarations are a matter of habit (Haven't publicly contributed much to Drupal).
Did you have any issues with errors or caching post-test on live instances or has anyone been able to recreate the bogus behavior reported?

grndlvl’s picture

StatusFileSize
new2.96 KB

Applied changes requested by comment #2.

Also tested patch all looks good.

cwgordon7’s picture

The patch looks great; however, one minor little nitpick that's probably outside the scope of the patch - while you're cleaning up the other test cases' getInfo() implementations, would you mind running their descriptions through t()? :)

grndlvl’s picture

StatusFileSize
new2.96 KB

went ahead and wrapped the descriptions in t() per comment #5 patch also contains #4.

grndlvl’s picture

Status: Needs work » Needs review
catch’s picture

Category: feature » bug
Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.96 KB

Did some very minor cleanup on the code comments, ran the tests, should be RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

As long as we're cleaning things up:

+  function getInfo() {
+  function setUp() {

Those both need "Impementation of ..." PHPDoc.

+    // Set the block to the disabled region.

That doesn't seem to be what the code below does? It looks like it's setting it to the 'right' region?

And there is at least one other tests missing here. Namely, if the user votes on a poll, the block should switch from showing a list of choices to showing the list of results. Make sure you're on a page other than the poll page to check this. Ideally, this goes before the test to see if the current poll is overwritten by the newer poll.

grndlvl’s picture

StatusFileSize
new3.77 KB

Made suggested changes from comment #9.

- Now checks if block shows results and is replaced when new poll is created.

grndlvl’s picture

Status: Needs work » Needs review
Anonymous’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

catch’s picture

Component: tests » poll.module
Category: bug » task
Priority: Critical » Normal

Moving this out of the critical bugs queue - see #607038: Meta issue: fix gaps in code coverage.

amateescu’s picture

Status: Needs work » Closed (fixed)