-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
121 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ayacoo\Tiktok\Tests\Functional\Domain\Repository; | ||
|
||
use Ayacoo\Tiktok\Domain\Repository\FileRepository; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
final class FileRepositoryTest extends FunctionalTestCase | ||
{ | ||
protected array $testExtensionsToLoad = ['tiktok']; | ||
|
||
private FileRepository $subject; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->subject = $this->get(FileRepository::class); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getVideosByFileExtensionForNoRecordsReturnsEmptyResult(): void | ||
{ | ||
$result = $this->subject->getVideosByFileExtension('jpg', 10); | ||
|
||
self::assertCount(0, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getVideosByFileExtensionReturnsSoundcloudMedia(): void | ||
{ | ||
$this->importCSVDataSet(__DIR__ . '/Fixtures/Basic.csv'); | ||
$row = $this->subject->getVideosByFileExtension('tiktok', 10); | ||
|
||
self::assertCount(1, $row); | ||
self::assertSame(1, $row[0]['uid']); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getVideosByFileExtensionWithMaxResultsReturnsSoundcloudMedia(): void | ||
{ | ||
$this->importCSVDataSet(__DIR__ . '/Fixtures/MaxResults.csv'); | ||
$row = $this->subject->getVideosByFileExtension('tiktok', 1); | ||
|
||
self::assertCount(1, $row); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getVideosByFileExtensionIgnoresMissingMedia(): void | ||
{ | ||
$this->importCSVDataSet(__DIR__ . '/Fixtures/MissingTiktok.csv'); | ||
$row = $this->subject->getVideosByFileExtension('tiktok', 1); | ||
|
||
self::assertCount(0, $row); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"sys_file" | ||
,"uid","identifier","missing","extension" | ||
,1,"/tiktok/armin_van_buuren_feat._mr_probz_-_another_you__out_now__by_armin_van_buuren.tiktok","0","tiktok" | ||
,2,"/dummy/test.png","0","png" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"sys_file" | ||
,"uid","identifier","missing","extension" | ||
,1,"/tiktok/armin_van_buuren_feat._mr_probz_-_another_you__out_now__by_armin_van_buuren.soundcloud","0","tiktok" | ||
,2,"/tiktok/scantraxx_-_back_to_the_rootz_002___hardstyle_classics_mix_by_scantraxx.tiktok","0","tiktok" |
3 changes: 3 additions & 0 deletions
3
Tests/Functional/Domain/Repository/Fixtures/MissingTiktok.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"sys_file" | ||
,"uid","identifier","missing","extension" | ||
,1,"/tiktok/armin_van_buuren_feat._mr_probz_-_another_you__out_now__by_armin_van_buuren.tiktok","1","tiktok" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ayacoo\Tiktok\Tests\Unit\Helper; | ||
|
||
use Ayacoo\Tiktok\Helper\TiktokHelper; | ||
use TYPO3\CMS\Core\Resource\File; | ||
use TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOEmbedHelper; | ||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase; | ||
|
||
final class TiktokHelperTest extends UnitTestCase | ||
{ | ||
private const TIKTOK_URL = 'https://www.tiktok.com/'; | ||
|
||
private TiktokHelper $subject; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->subject = new TiktokHelper('tiktok'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function isAbstractOEmbedHelper(): void | ||
{ | ||
self::assertInstanceOf(AbstractOEmbedHelper::class, $this->subject); | ||
} | ||
} |