X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/1b93464c68d398351410d871826e30066bfdbb2f..8a811b6e3fcb76256888cb83409cf56a4a0b7191:/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php diff --git a/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php b/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php index 19c2ad42ff9..784d11449f3 100644 --- a/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php @@ -31,6 +31,71 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class RequestHandlerTest extends UnitTestCase { + public function generateHtmlTagIncludesAllPossibilitiesDataProvider() + { + return [ + 'no original values' => [ + [], + [], + '' + ], + 'no additional values' => [ + ['dir' => 'left'], + [], + '' + ], + 'no additional values #2' => [ + ['dir' => 'left', 'xmlns:dir' => 'left'], + [], + '' + ], + 'disable all attributes' => [ + ['dir' => 'left', 'xmlns:dir' => 'left'], + ['htmlTag_setParams' => 'none'], + '' + ], + 'only add setParams' => [ + ['dir' => 'left', 'xmlns:dir' => 'left'], + ['htmlTag_setParams' => 'amp'], + '' + ], + 'attributes property trumps htmlTag_setParams' => [ + ['dir' => 'left', 'xmlns:dir' => 'left'], + ['htmlTag.' => ['attributes.' => ['amp' => '']], 'htmlTag_setParams' => 'none'], + '' + ], + 'attributes property with mixed values' => [ + ['dir' => 'left', 'xmlns:dir' => 'left'], + ['htmlTag.' => ['attributes.' => ['amp' => '', 'no-js' => 'true', 'additional-enabled' => 0]]], + '' + ], + 'attributes property overrides default settings' => [ + ['dir' => 'left'], + ['htmlTag.' => ['attributes.' => ['amp' => '', 'dir' => 'right']]], + '' + ], + ]; + } + + /** + * Does not test stdWrap functionality. + * + * @param $htmlTagAttributes + * @param $configuration + * @param $expectedResult + * @test + * @dataProvider generateHtmlTagIncludesAllPossibilitiesDataProvider + */ + public function generateHtmlTagIncludesAllPossibilities($htmlTagAttributes, $configuration, $expectedResult) + { + $subject = $this->getAccessibleMock(RequestHandler::class, ['dummy'], [], '', false); + $cObj = $this->prophesize(ContentObjectRenderer::class); + $cObj->stdWrap(Argument::cetera())->shouldNotBeCalled(); + $result = $subject->_call('generateHtmlTag', $htmlTagAttributes, $configuration, $cObj->reveal()); + + $this->assertEquals($expectedResult, $result); + } + /** * @return array */