public function ProviderUrlParseTest::testVimeoTimeIndex in Video Embed Field 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/ProviderUrlParseTest.php \Drupal\Tests\video_embed_field\Unit\ProviderUrlParseTest::testVimeoTimeIndex()
Test the Vimeo time index integration.
@dataProvider vimeoTimeIndexTestCases
File
- tests/
src/ Unit/ ProviderUrlParseTest.php, line 291
Class
- ProviderUrlParseTest
- Test that URL parsing for various providers is functioning.
Namespace
Drupal\Tests\video_embed_field\UnitCode
public function testVimeoTimeIndex($url, $expected, $exception_expected = FALSE) {
$exception_triggered = FALSE;
try {
$provider = new Vimeo([
'input' => $url,
], '', [], new MockHttpClient());
} catch (\Exception $e) {
$exception_triggered = TRUE;
}
$this
->assertEquals($exception_expected, $exception_triggered);
if (!$exception_triggered) {
$embed = $provider
->renderEmbedCode(100, 100, TRUE);
$this
->assertEquals($expected, isset($embed['#fragment']) ? $embed['#fragment'] : FALSE);
}
}