-
Notifications
You must be signed in to change notification settings - Fork 1
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
10 changed files
with
238 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
include_once __DIR__ . '/../../.Build/vendor/autoload.php'; | ||
|
||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\Translation\Command\XliffLintCommand; | ||
use Symfony\Component\Yaml\Command\LintCommand; | ||
|
||
$application = new Application(); | ||
$application->add(new XliffLintCommand(null, null, null, false)); | ||
$application->add(new LintCommand()); | ||
|
||
exit($application->run()); |
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
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
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
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,79 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ayacoo\AyacooSoundcloud\Tests\Unit\Rendering; | ||
|
||
use Ayacoo\AyacooSoundcloud\Helper\SoundcloudHelper; | ||
use Ayacoo\AyacooSoundcloud\Rendering\SoundcloudRenderer; | ||
use Psr\EventDispatcher\EventDispatcherInterface; | ||
use TYPO3\CMS\Core\Resource\File; | ||
use TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface; | ||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; | ||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase; | ||
|
||
final class SoundcloudRendererTest extends UnitTestCase | ||
{ | ||
private SoundcloudRenderer $subject; | ||
|
||
protected bool $resetSingletonInstances = true; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$eventDispatcherMock = $this->getMockBuilder(EventDispatcherInterface::class)->getMock(); | ||
//$eventDispatcherMock->expects(self::atLeastOnce())->method('dispatch')->with(self::anything())->willReturnArgument(0); | ||
|
||
$configurationManager = $this->getMockBuilder(ConfigurationManager::class) | ||
->onlyMethods(['getConfiguration']) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$this->subject = new SoundcloudRenderer($eventDispatcherMock, $configurationManager); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function hasFileRendererInterface(): void | ||
{ | ||
self::assertInstanceOf(FileRendererInterface::class, $this->subject); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function canRenderWithMatchingMimeTypeReturnsTrue(): void | ||
{ | ||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['onlineMediaHelpers']['soundcloud'] = SoundcloudHelper::class; | ||
|
||
$fileResourceMock = $this->createMock(File::class); | ||
$fileResourceMock->expects(self::any())->method('getMimeType')->willReturn('audio/soundcloud'); | ||
$fileResourceMock->expects(self::any())->method('getExtension')->willReturn('soundcloud'); | ||
|
||
$result = $this->subject->canRender($fileResourceMock); | ||
self::assertTrue($result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function canRenderWithMatchingMimeTypeReturnsFalse(): void | ||
{ | ||
$fileResourceMock = $this->createMock(File::class); | ||
$fileResourceMock->expects(self::any())->method('getMimeType')->willReturn('video/youtube'); | ||
$fileResourceMock->expects(self::any())->method('getExtension')->willReturn('youtube'); | ||
|
||
$result = $this->subject->canRender($fileResourceMock); | ||
self::assertFalse($result); | ||
} | ||
|
||
private function buildReflectionForProtectedFunction(string $methodName, array $params) | ||
{ | ||
$reflectionCalendar = new \ReflectionClass($this->subject); | ||
$method = $reflectionCalendar->getMethod($methodName); | ||
$method->setAccessible(true); | ||
return $method->invokeArgs($this->subject, $params); | ||
} | ||
} |
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,19 @@ | ||
parameters: | ||
parallel: | ||
# Don't be overly greedy on machines with more CPU's to be a good neighbor especially on CI | ||
maximumNumberOfProcesses: 5 | ||
|
||
level: 3 | ||
|
||
bootstrapFiles: | ||
- .Build/vendor/autoload.php | ||
|
||
paths: | ||
- Classes | ||
- Configuration | ||
- Tests | ||
|
||
scanDirectories: | ||
- Classes | ||
- Configuration | ||
- Tests |