You are here

function dsHooksTests::testDSFields in Display Suite 7

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

Test fields hooks.

File

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

Class

dsHooksTests
Tests for Display Suite hookds.

Code

function testDSFields() {
  $this
    ->dsSelectLayout();

  // Find the two extra fields from the test module on the node type.
  $this
    ->drupalGet('admin/structure/types/manage/article/display');
  $this
    ->assertText('Test code field from hook', 'Test field found on node.');
  $this
    ->assertText('Field altered', 'Test field altered found on node.');
  $empty = array();
  $edit = array(
    'additional_settings[layout]' => 'ds_2col_stacked',
  );
  $this
    ->dsSelectLayout($edit, $empty, 'admin/config/people/accounts/display');

  // Fields can not be found on user.
  $this
    ->drupalGet('admin/config/people/accounts/display');
  $this
    ->assertNoText('Test code field from hook', 'Test field not found on user.');
  $this
    ->assertNoText('Field altered', 'Test field altered not found on user.');

  // Select layout.
  $this
    ->dsSelectLayout();
  $fields = array(
    'fields[author][region]' => 'left',
    'fields[links][region]' => 'left',
    'fields[body][region]' => 'right',
    'fields[ds_test_field][region]' => 'right',
  );
  $this
    ->dsSelectLayout();
  $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
    ->assertText('Test code field on node ' . $node->nid, 'Test code field found');
}