function EntityMaskTest::testFormDisplays
Same name in other branches
- 4.0.x modules/ctools_entity_mask/tests/src/Kernel/EntityMaskTest.php \Drupal\Tests\ctools_entity_mask\Kernel\EntityMaskTest::testFormDisplays()
Tests that entity form displays are correctly masked.
File
-
modules/
ctools_entity_mask/ tests/ src/ Kernel/ EntityMaskTest.php, line 84
Class
- EntityMaskTest
- Basic test of entity type masking.
Namespace
Drupal\Tests\ctools_entity_mask\KernelCode
public function testFormDisplays() {
EntityFormMode::create([
'id' => 'block_content.foobar',
'label' => $this->randomString(),
'targetEntityType' => 'block_content',
])
->save();
$form_modes = $this->container
->get('entity_display.repository')
->getAllFormModes();
$this->assertSame($form_modes['block_content'], $form_modes['fake_block_content']);
$storage = $this->container
->get('entity_type.manager')
->getStorage('entity_form_display');
$display = $storage->create([
'targetEntityType' => 'fake_block_content',
'bundle' => 'basic',
'mode' => 'default',
'status' => TRUE,
]);
$this->assertTrue($display->isNew());
$components = $display->getComponents();
$this->assertArrayHasKey('body', $components);
$this->assertArrayHasKey('field_link', $components);
$this->assertArrayHasKey('field_image', $components);
}