You are here

public function ProviderUrlParseTest::languageParseTestCases 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::languageParseTestCases()

A data provider for testYouTubeLanguageParsing.

Return value

array An array of test cases.

File

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

Class

ProviderUrlParseTest
Test that URL parsing for various providers is functioning.

Namespace

Drupal\Tests\video_embed_field\Unit

Code

public function languageParseTestCases() {
  return [
    'Simple Preference' => [
      'https://youtube.com/watch?v=fdbFV_Wup-Ssw&hl=fr',
      'fr',
    ],
    'Preference with Hyphen' => [
      'https://youtube.com/watch?v=fdbFV_Wup-Ssw&hl=fr-ca',
      'fr-ca',
    ],
    'Invalid Language' => [
      'https://youtube.com/watch?v=fdbFV_Wup-Ssw&hl=<test>',
      FALSE,
    ],
    'Multiple Parameters' => [
      'https://youtube.com/watch?v=fdbFV_Wup-Ssw&hl=au&anotherparam=1',
      'au',
    ],
  ];
}