You are here

public function ProviderUrlParseTest::testYouTubeLanguageParsing in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/ProviderUrlParseTest.php \Drupal\Tests\video_embed_field\Unit\ProviderUrlParseTest::testYouTubeLanguageParsing()

Test the langauge parsing feature.

@dataProvider languageParseTestCases

File

tests/src/Unit/ProviderUrlParseTest.php, line 198

Class

ProviderUrlParseTest
Test that URL parsing for various providers is functioning.

Namespace

Drupal\Tests\video_embed_field\Unit

Code

public function testYouTubeLanguageParsing($url, $expected) {
  $provider = new YouTube([
    'input' => $url,
  ], '', [], new MockHttpClient());
  $embed = $provider
    ->renderEmbedCode(100, 100, TRUE);
  $language = isset($embed['#query']['cc_lang_pref']) ? $embed['#query']['cc_lang_pref'] : FALSE;
  $this
    ->assertEquals($expected, $language);
}