$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();

    // Check to see if the custom block was created by checking that it's in the database.
    $this->assertNotNull($bid, t('Custom block found in database'));

fetchField will return false if there is nothing to fetch or the value of the field if the query gets a result. In both cases assertNotNull is going to be TRUE, so that test is testing nothing at all. The correct assertion would be to assert it is not false, assertTrue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manfer’s picture

Status: Active » Needs review
FileSize
1.24 KB

Here is a patch correcting the two places were that incorrect assertion appears.

dcam’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll, +Novice

I was looking through some old issues and found this one. It looks like a valid bug to me. I checked D8 for these assertions and they seem to have been removed completely due to the major changes in the Block module. #1 just needs to be rerolled for 7.x.

joshi.rohit100’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.08 KB

Rerolled the patch.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. Thank you, @joshi.rohit100!

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

  • David_Rothstein committed 517f137 on 7.x
    Issue #1018618 by manfer, joshi.rohit100: Wrong assertions in block.test
    

Status: Fixed » Closed (fixed)

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