You are here

function BlockHashTestCase::assertWeight in Drupal 7

Asserts that the block_test module's block has a given weight.

Parameters

$weight: The expected weight.

1 call to BlockHashTestCase::assertWeight()
BlockHashTestCase::testBlockRehash in modules/block/block.test
Tests that block rehashing does not write to the database too often.

File

modules/block/block.test, line 974
Tests for block.module.

Class

BlockHashTestCase
Tests that block rehashing works correctly.

Code

function assertWeight($weight) {
  $db_weight = db_query('SELECT weight FROM {block} WHERE module = :module AND delta = :delta', array(
    ':module' => 'block_test',
    ':delta' => 'test_html_id',
  ))
    ->fetchField();

  // By casting to string the assert fails on FALSE.
  $this
    ->assertIdentical((string) $db_weight, (string) $weight);
}