1 common.test CommonBackdropRenderTestCase::testBackdropRenderBasics()

Tests the output backdrop_render() for some elementary input values.

File

core/modules/simpletest/tests/common.test, line 1963
Tests for common.inc functionality.

Class

CommonBackdropRenderTestCase
Tests for backdrop_render().

Code

function testBackdropRenderBasics() {
  $types = array(
    array(
      'name' => 'null',
      'value' => NULL,
      'expected' => '',
    ),
    array(
      'name' => 'no value',
      'expected' => '',
    ),
    array(
      'name' => 'empty string',
      'value' => '',
      'expected' => '',
    ),
    array(
      'name' => 'no access',
      'value' => array(
        '#markup' => 'foo',
        '#access' => FALSE,
      ),
      'expected' => '',
    ),
    array(
      'name' => 'previously printed',
      'value' => array(
        '#markup' => 'foo',
        '#printed' => TRUE,
      ),
      'expected' => '',
    ),
    array(
      'name' => 'printed in prerender',
      'value' => array(
        '#markup' => 'foo',
        '#pre_render' => array('common_test_backdrop_render_printing_pre_render'),
      ),
      'expected' => '',
    ),
    array(
      'name' => 'basic renderable array',
      'value' => array('#markup' => 'foo'),
      'expected' => 'foo',
    ),
  );
  foreach ($types as $type) {
    $this->assertIdentical(backdrop_render($type['value']), $type['expected'], '"' . $type['name'] . '" input rendered correctly by backdrop_render().');
  }
}