]> git.mxchange.org Git - friendica.git/blob - tests/src/Content/Text/BBCode/VideoTest.php
Merge remote-tracking branch 'upstream/develop' into issue-3229
[friendica.git] / tests / src / Content / Text / BBCode / VideoTest.php
1 <?php
2
3 namespace Friendica\Test\Content\Text\BBCode;
4
5 use Friendica\Content\Text\BBCode\Video;
6 use Friendica\Test\MockedTest;
7
8 class VideoTest extends MockedTest
9 {
10         public function dataVideo()
11         {
12                 return [
13                         'youtube' => [
14                                 'input' => '[video]https://youtube.link/4523[/video]',
15                                 'assert' => '[youtube]https://youtube.link/4523[/youtube]',
16                         ],
17                         'youtu.be' => [
18                                 'input' => '[video]https://youtu.be.link/4523[/video]',
19                                 'assert' => '[youtube]https://youtu.be.link/4523[/youtube]',
20                         ],
21                         'vimeo' => [
22                                 'input' => '[video]https://vimeo.link/2343[/video]',
23                                 'assert' => '[vimeo]https://vimeo.link/2343[/vimeo]',
24                         ],
25                         'mixed' => [
26                                 'input' => '[video]https://vimeo.link/2343[/video] With other [b]string[/b] [video]https://youtu.be/blaa[/video]',
27                                 'assert' => '[vimeo]https://vimeo.link/2343[/vimeo] With other [b]string[/b] [youtube]https://youtu.be/blaa[/youtube]',
28                         ]
29                 ];
30         }
31
32         /**
33          * Test if the BBCode is successfully transformed for video links
34          *
35          * @dataProvider dataVideo
36          */
37         public function testTransform(string $input, string $assert)
38         {
39                 $bbCodeVideo = new Video();
40
41                 $this->assertEquals($assert, $bbCodeVideo->transform($input));
42         }
43 }