ProviderUrlParseTest.php in Video Embed Instagram 8
File
tests/src/Unit/ProviderUrlParseTest.php
View source
<?php
namespace Drupal\Tests\video_embed_instagram\Unit;
use Drupal\Tests\UnitTestCase;
use Drupal\video_embed_instagram\Plugin\video_embed_field\Provider\Instagram;
class ProviderUrlParseTest extends UnitTestCase {
public function testUrlParsing($url, $expected) {
$this
->assertEquals($expected, Instagram::getIdFromInput($url));
}
public function urlsWithExpectedIds() {
return [
[
'https://www.instagram.com/p/BDAtHPYSeO4/',
'BDAtHPYSeO4',
],
[
'http://www.instagram.com/p/BDAtHPYSeO4/',
'BDAtHPYSeO4',
],
[
'http://www.instagram.com/p/BDAtHPYSeO4',
'BDAtHPYSeO4',
],
[
'https://www.instagram.com/p/BDAtHPYSeO4',
'BDAtHPYSeO4',
],
[
'https://www.instagram.com/p/BFElYdqjJwa/?taken-by=9gag',
'BFElYdqjJwa',
],
];
}
}