mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 04:54:27 +02:00
Move bb_translate_video
- To new Class BBCode\Video - Adding tests - Make BaseObject::getClass() public
This commit is contained in:
parent
7f49c73730
commit
2870f42ca2
5 changed files with 80 additions and 20 deletions
43
tests/src/Content/Text/BBCode/VideoTest.php
Normal file
43
tests/src/Content/Text/BBCode/VideoTest.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace src\Content\Text\BBCode;
|
||||
|
||||
use Friendica\Content\Text\BBCode\Video;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
||||
class VideoTest extends MockedTest
|
||||
{
|
||||
public function dataVideo()
|
||||
{
|
||||
return [
|
||||
'youtube' => [
|
||||
'input' => '[video]https://youtube.link/4523[/video]',
|
||||
'assert' => '[youtube]https://youtube.link/4523[/youtube]',
|
||||
],
|
||||
'youtu.be' => [
|
||||
'input' => '[video]https://youtu.be.link/4523[/video]',
|
||||
'assert' => '[youtube]https://youtu.be.link/4523[/youtube]',
|
||||
],
|
||||
'vimeo' => [
|
||||
'input' => '[video]https://vimeo.link/2343[/video]',
|
||||
'assert' => '[vimeo]https://vimeo.link/2343[/vimeo]',
|
||||
],
|
||||
'mixed' => [
|
||||
'input' => '[video]https://vimeo.link/2343[/video] With other [b]string[/b] [video]https://youtu.be/blaa[/video]',
|
||||
'assert' => '[vimeo]https://vimeo.link/2343[/vimeo] With other [b]string[/b] [youtube]https://youtu.be/blaa[/youtube]',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the BBCode is successfully transformed for video links
|
||||
*
|
||||
* @dataProvider dataVideo
|
||||
*/
|
||||
public function testTransform(string $input, string $assert)
|
||||
{
|
||||
$bbCodeVideo = new Video();
|
||||
|
||||
$this->assertEquals($assert, $bbCodeVideo->transform($input));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue