You are here

public function EntityDisplayTest::testEntityGetDisplay in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field_ui/src/Tests/EntityDisplayTest.php \Drupal\field_ui\Tests\EntityDisplayTest::testEntityGetDisplay()

Tests entity_get_display().

File

core/modules/field_ui/src/Tests/EntityDisplayTest.php, line 142
Contains \Drupal\field_ui\Tests\EntityDisplayTest.

Class

EntityDisplayTest
Tests the entity display configuration entities.

Namespace

Drupal\field_ui\Tests

Code

public function testEntityGetDisplay() {

  // Check that entity_get_display() returns a fresh object when no
  // configuration entry exists.
  $display = entity_get_display('entity_test', 'entity_test', 'default');
  $this
    ->assertTrue($display
    ->isNew());

  // Add some components and save the display.
  $display
    ->setComponent('component_1', array(
    'weight' => 10,
    'settings' => array(),
  ))
    ->save();

  // Check that entity_get_display() returns the correct object.
  $display = entity_get_display('entity_test', 'entity_test', 'default');
  $this
    ->assertFalse($display
    ->isNew());
  $this
    ->assertEqual($display
    ->id(), 'entity_test.entity_test.default');
  $this
    ->assertEqual($display
    ->getComponent('component_1'), array(
    'weight' => 10,
    'settings' => array(),
    'third_party_settings' => array(),
  ));
}