You are here

public function EntityDisplayTest::testEntityDisplayCRUDSort 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::testEntityDisplayCRUDSort()

Test sorting of components by name on basic CRUD operations

File

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

Class

EntityDisplayTest
Tests the entity display configuration entities.

Namespace

Drupal\field_ui\Tests

Code

public function testEntityDisplayCRUDSort() {
  $display = EntityViewDisplay::create(array(
    'targetEntityType' => 'entity_test',
    'bundle' => 'entity_test',
    'mode' => 'default',
  ));
  $display
    ->setComponent('component_3');
  $display
    ->setComponent('component_1');
  $display
    ->setComponent('component_2');
  $display
    ->save();
  $components = array_keys($display
    ->getComponents());

  // The name field is not configurable so will be added automatically.
  $expected = array(
    0 => 'component_1',
    1 => 'component_2',
    2 => 'component_3',
    'name',
  );
  $this
    ->assertIdentical($components, $expected);
}