You are here

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

A data provider for testYouTubeTimeIndex.

Return value

array An array of test cases.

File

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

Class

ProviderUrlParseTest
Test that URL parsing for various providers is functioning.

Namespace

Drupal\Tests\video_embed_field\Unit

Code

public function youTubeTimeIndexTestCases() {
  return [
    'Simple Timeindex' => [
      'https://www.youtube.com/watch?v=fdbFVWupSsw&t=15',
      15,
    ],
    'Timeindex with Seconds' => [
      'https://www.youtube.com/watch?v=q25eaJHpXFo&t=15s',
      15,
    ],
    'Timeindex with Minutes and Seconds' => [
      'https://www.youtube.com/watch?v=q25eaJHpXFo&t=42m25s',
      2545,
    ],
    'Timeindex with Hours, Minutes and Seconds' => [
      'https://www.youtube.com/watch?v=q25eaJHpXFo&t=1h11m14s',
      4274,
    ],
    'Timeindex with other params' => [
      'https://www.youtube.com/watch?v=q25eaJHpXFo&t=1h11m14s&some_param=nothing',
      4274,
    ],
    'No Timeindex' => [
      'https://www.youtube.com/watch?v=fdbFVWupSsw',
      0,
    ],
    'Invalid Timeindex' => [
      'https://www.youtube.com/watch?v=fdbFVWupSsw&t=time',
      0,
    ],
  ];
}