You are here

public function UpdateTest::testUpdate8201 in oEmbed Providers 2.x

Tests oembed_providers_update_8201().

File

tests/src/Kernel/UpdateTest.php, line 42

Class

UpdateTest
Tests update functions.

Namespace

Drupal\Tests\oembed_providers\Kernel

Code

public function testUpdate8201() {

  // Write config with removed 'allowed_providers' value.
  \Drupal::service('config.factory')
    ->getEditable('oembed_providers.settings')
    ->setData([
    'external_fetch' => TRUE,
    'allowed_providers' => [
      'youtube',
      'another_provider',
    ],
  ])
    ->save();

  // Run update function.
  module_load_install('oembed_providers');
  oembed_providers_update_8201();

  // Verify that a 'video' provider bucket was created and that the providers
  // were property set.
  $video_bucket = ProviderBucket::load('video');
  $this
    ->assertEquals([
    'youtube',
    'another_provider',
  ], $video_bucket
    ->get('providers'));
}