ProviderUrlParseTest.php in Video Embed HTML5 8
File
tests/src/Unit/ProviderUrlParseTest.php
View source
<?php
namespace Drupal\Tests\video_embed_html5\Unit;
use Drupal\Tests\UnitTestCase;
use Drupal\video_embed_brightcove\Plugin\video_embed_field\Provider\Brightcove;
use Drupal\video_embed_html5\Plugin\video_embed_field\Provider\Html5;
class ProviderUrlParseTest extends UnitTestCase {
public function testUrlParsing($url, $expected) {
if (is_array($expected)) {
$this
->assertArrayEquals($expected, Html5::getIdFromInput($url));
}
else {
$this
->assertEquals($expected, Html5::getIdFromInput($url));
}
}
public function urlsWithExpectedIds() {
return [
'HTML5 video' => [
'https://www.html5rocks.com/en/tutorials/video/basics/devstories.mp4',
[
'https://www.html5rocks.com/en/tutorials/video/basics/devstories.mp4',
'mp4',
],
],
'No HTML5 video' => [
'https://www.youtube.com/watch?v=8HVWitAW-Qg',
FALSE,
],
];
}
}