X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FUpdateEntityDisplayTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FUpdateEntityDisplayTest.php;h=187c7ac9199b43b5449cec8699bd909d5c717ce9;hp=698d331099cb0668b060716bdf77118bc7a7d0a2;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/system/tests/src/Functional/Update/UpdateEntityDisplayTest.php b/web/core/modules/system/tests/src/Functional/Update/UpdateEntityDisplayTest.php index 698d33109..187c7ac91 100644 --- a/web/core/modules/system/tests/src/Functional/Update/UpdateEntityDisplayTest.php +++ b/web/core/modules/system/tests/src/Functional/Update/UpdateEntityDisplayTest.php @@ -7,9 +7,10 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\FunctionalTests\Update\UpdatePathTestBase; /** - * Tests system_post_update_add_region_to_entity_displays(). + * Tests updates for entity displays. * * @group Update + * @group legacy */ class UpdateEntityDisplayTest extends UpdatePathTestBase { @@ -24,8 +25,10 @@ class UpdateEntityDisplayTest extends UpdatePathTestBase { /** * Tests that entity displays are updated with regions for their fields. + * + * @see system_post_update_add_region_to_entity_displays() */ - public function testUpdate() { + public function testRegionUpdate() { // No region key appears pre-update. $entity_form_display = EntityFormDisplay::load('node.article.default'); $options = $entity_form_display->getComponent('body'); @@ -47,4 +50,22 @@ class UpdateEntityDisplayTest extends UpdatePathTestBase { $this->assertIdentical('content', $options['region']); } + /** + * Tests that entity displays are updated to properly store extra fields. + * + * @see system_post_update_extra_fields() + */ + public function testExtraFieldsUpdate() { + $assertion = function ($expected_keys) { + $entity_view_display = EntityViewDisplay::load('node.article.default'); + $this->assertEquals($expected_keys, array_keys($entity_view_display->getComponent('links'))); + }; + + // Before the update extra fields are missing additional configuration. + $assertion(['weight', 'region']); + $this->runUpdates(); + // After the update the additional configuration is present. + $assertion(['weight', 'region', 'settings', 'third_party_settings']); + } + }