function OembedUpdateTest::testUpdate

Same name in other branches
  1. 10 core/modules/media/tests/src/Functional/FieldFormatter/OembedUpdateTest.php \Drupal\Tests\media\Functional\FieldFormatter\OembedUpdateTest::testUpdate()

Test eager-load setting upgrade path.

@legacy

See also

media_post_update_oembed_loading_attribute

File

core/modules/media/tests/src/Functional/FieldFormatter/OembedUpdateTest.php, line 51

Class

OembedUpdateTest
Tests eager-load upgrade path.

Namespace

Drupal\Tests\media\Functional\FieldFormatter

Code

public function testUpdate() : void {
    $this->expectDeprecation('The oEmbed loading attribute update for view display "media.remote_video.default" is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Profile, module and theme provided configuration should be updated. See https://www.drupal.org/node/3275103');
    $data = EntityViewDisplay::load('media.remote_video.default')->toArray();
    $this->assertArrayNotHasKey('loading', $data['content']['field_media_oembed_video']['settings']);
    $this->runUpdates();
    $data = EntityViewDisplay::load('media.remote_video.default')->toArray();
    $this->assertArrayHasKey('loading', $data['content']['field_media_oembed_video']['settings']);
    $this->assertEquals('eager', $data['content']['field_media_oembed_video']['settings']['loading']['attribute']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.