-
-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Fix extensionlaoded VH #2572
- Loading branch information
1 parent
f534ef9
commit 34f53e1
Showing
2 changed files
with
50 additions
and
4 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
48 changes: 48 additions & 0 deletions
48
Tests/Functional/ViewHelpers/ExtensionLoadedViewHelperTest.php
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,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the "news" Extension for TYPO3 CMS. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Functional\ViewHelpers; | ||
|
||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\Attributes\IgnoreDeprecations; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
use TYPO3Fluid\Fluid\View\TemplateView; | ||
|
||
class ExtensionLoadedViewHelperTest extends FunctionalTestCase | ||
{ | ||
|
||
public static function extensionLoadedDataProvider(): array | ||
{ | ||
return [ | ||
'validExtension' => [ | ||
'<n:extensionLoaded extensionKey="core">1</n:extensionLoaded>', | ||
'1', | ||
], | ||
'invalidExtension' => [ | ||
'<n:extensionLoaded extensionKey="something">1</n:extensionLoaded>', | ||
'', | ||
], | ||
]; | ||
} | ||
|
||
#[DataProvider('extensionLoadedDataProvider')] | ||
#[IgnoreDeprecations] | ||
#[Test] | ||
public function extensionLoaded(string $src, string $expected): void | ||
{ | ||
$src = '<html xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers" data-namespace-typo3-fluid="true">' . $src . '</html>'; | ||
$context = $this->get(RenderingContextFactory::class)->create(); | ||
$context->getTemplatePaths()->setTemplateSource($src); | ||
self::assertSame($expected, (new TemplateView($context))->render()); | ||
} | ||
} |