You are here

function dsHooksTests::testDSLayouts in Display Suite 7

Same name and namespace in other branches
  1. 7.2 tests/ds.base.test \dsHooksTests::testDSLayouts()

Test layouts hook.

File

tests/ds.base.test, line 727
Base functions and tests for Display Suite.

Class

dsHooksTests
Tests for Display Suite hookds.

Code

function testDSLayouts() {

  // Assert our 2 tests layouts are found.
  $this
    ->drupalGet('admin/structure/types/manage/article/display');
  $this
    ->assertRaw('Test One column', 'Test One column layout found');
  $this
    ->assertRaw('Test Two column', 'Test Two column layout found');
  $layout = array(
    'additional_settings[layout]' => 'dstest_2col',
  );
  $assert = array(
    'regions' => array(
      'left' => '<td colspan="8">' . t('Left') . '</td>',
      'right' => '<td colspan="8">' . t('Right') . '</td>',
    ),
  );
  $fields = array(
    'fields[author][region]' => 'left',
    'fields[links][region]' => 'left',
    'fields[body][region]' => 'right',
  );
  $this
    ->dsSelectLayout($layout, $assert);
  $this
    ->dsConfigureUI($fields);

  // Create a node.
  $settings = array(
    'type' => 'article',
  );
  $node = $this
    ->drupalCreateNode($settings);
  $this
    ->drupalGet('node/' . $node->nid);
  $this
    ->assertRaw('group-left', 'Template found (region left)');
  $this
    ->assertRaw('group-right', 'Template found (region right)');
  $this
    ->assertRaw('dstest_2col.css', 'Css file included');
}