public function EntityFormDisplayTest::testEntityGetFromDisplay in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field_ui/src/Tests/EntityFormDisplayTest.php \Drupal\field_ui\Tests\EntityFormDisplayTest::testEntityGetFromDisplay()
Tests entity_get_form_display().
File
- core/
modules/ field_ui/ src/ Tests/ EntityFormDisplayTest.php, line 37 - Contains \Drupal\field_ui\Tests\EntityFormDisplayTest.
Class
- EntityFormDisplayTest
- Tests the entity display configuration entities.
Namespace
Drupal\field_ui\TestsCode
public function testEntityGetFromDisplay() {
// Check that entity_get_form_display() returns a fresh object when no
// configuration entry exists.
$form_display = entity_get_form_display('entity_test', 'entity_test', 'default');
$this
->assertTrue($form_display
->isNew());
// Add some components and save the display.
$form_display
->setComponent('component_1', array(
'weight' => 10,
))
->save();
// Check that entity_get_form_display() returns the correct object.
$form_display = entity_get_form_display('entity_test', 'entity_test', 'default');
$this
->assertFalse($form_display
->isNew());
$this
->assertEqual($form_display
->id(), 'entity_test.entity_test.default');
$this
->assertEqual($form_display
->getComponent('component_1'), array(
'weight' => 10,
'settings' => array(),
'third_party_settings' => array(),
));
}