3 namespace Drupal\Tests\system\Functional\Update;
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\Core\Entity\Entity\EntityViewDisplay;
7 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
10 * Tests system_post_update_add_region_to_entity_displays().
14 class UpdateEntityDisplayTest extends UpdatePathTestBase {
19 protected function setDatabaseDumpFiles() {
20 $this->databaseDumpFiles = [
21 __DIR__ . '/../../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
26 * Tests that entity displays are updated with regions for their fields.
28 public function testUpdate() {
29 // No region key appears pre-update.
30 $entity_form_display = EntityFormDisplay::load('node.article.default');
31 $options = $entity_form_display->getComponent('body');
32 $this->assertFalse(array_key_exists('region', $options));
34 $entity_view_display = EntityViewDisplay::load('node.article.default');
35 $options = $entity_view_display->getComponent('body');
36 $this->assertFalse(array_key_exists('region', $options));
40 // The region key has been populated with 'content'.
41 $entity_form_display = EntityFormDisplay::load('node.article.default');
42 $options = $entity_form_display->getComponent('body');
43 $this->assertIdentical('content', $options['region']);
45 $entity_view_display = EntityViewDisplay::load('node.article.default');
46 $options = $entity_view_display->getComponent('body');
47 $this->assertIdentical('content', $options['region']);