2 declare(strict_types = 1);
18 use Prophecy\Argument;
25 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
37 GeneralUtility::purgeInstances();
49 'author' =>
'Markus Klein',
55 'content' =>
'Markus Klein'
58 'httpEquivalent meta' => [
60 'X-UA-Compatible' =>
'IE=edge,chrome=1',
61 'X-UA-Compatible.' => [
'httpEquivalent' => 1]
65 'type' =>
'http-equiv',
66 'name' =>
'X-UA-Compatible',
67 'content' =>
'IE=edge,chrome=1'
70 'httpEquivalent meta xhtml new notation' => [
72 'X-UA-Compatible' =>
'IE=edge,chrome=1',
73 'X-UA-Compatible.' => [
'attribute' =>
'http-equiv']
77 'type' =>
'http-equiv',
78 'name' =>
'X-UA-Compatible',
79 'content' =>
'IE=edge,chrome=1'
88 'type' =>
'http-equiv',
93 'refresh meta new notation' => [
96 'refresh.' => [
'attribute' =>
'http-equiv']
100 'type' =>
'http-equiv',
107 'DC.author' =>
'Markus Klein',
112 'name' =>
'DC.author',
113 'content' =>
'Markus Klein'
116 'meta with colon' => [
118 'OG:title' =>
'Magic Tests',
123 'name' =>
'OG:title',
124 'content' =>
'Magic Tests'
127 'different attribute name' => [
129 'og:site_title' =>
'My TYPO3 site',
130 'og:site_title.' => [
'attribute' =>
'property'],
134 'type' =>
'property',
135 'name' =>
'og:site_title',
136 'content' =>
'My TYPO3 site'
139 'meta with 0 value' => [
146 'name' =>
'custom:key',
158 $stdWrapResult =
'10';
162 'refresh.' => [
'attribute' =>
'http-equiv-new']
166 'type' =>
'http-equiv-new',
171 $cObj = $this->prophesize(ContentObjectRenderer::class);
172 $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
173 $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
174 $tmpl = $this->prophesize(TemplateService::class);
175 $tsfe = $this->prophesize(TypoScriptFrontendController::class);
176 $tsfe->generatePageTitle()->willReturn(
'');
177 $tsfe->INTincScript_loadJSCode()->shouldBeCalled();
178 $tsfe->cObj = $cObj->reveal();
179 $tsfe->tmpl = $tmpl->reveal();
184 'meta.' => $typoScript
188 $pageRendererProphecy = $this->prophesize(PageRenderer::class);
189 GeneralUtility::setSingletonInstance(PageRenderer::class, $pageRendererProphecy->reveal());
193 $pageRendererProphecy->setMetaTag($expectedTags[
'type'], $expectedTags[
'name'], $expectedTags[
'content'])->willThrow(\InvalidArgumentException::class);
206 $cObj = $this->prophesize(ContentObjectRenderer::class);
207 $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
208 $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
209 $tmpl = $this->prophesize(TemplateService::class);
210 $tsfe = $this->prophesize(TypoScriptFrontendController::class);
211 $tsfe->generatePageTitle()->willReturn(
'');
212 $tsfe->INTincScript_loadJSCode()->shouldBeCalled();
213 $tsfe->cObj = $cObj->reveal();
214 $tsfe->tmpl = $tmpl->reveal();
222 'meta.' => $typoScript
226 $pageRendererProphecy = $this->prophesize(PageRenderer::class);
227 GeneralUtility::setSingletonInstance(PageRenderer::class, $pageRendererProphecy->reveal());
231 $pageRendererProphecy->setMetaTag($expectedTags[
'type'], $expectedTags[
'name'], $expectedTags[
'content'], [],
false)->shouldHaveBeenCalled();
245 $cObj = $this->prophesize(ContentObjectRenderer::class);
246 $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
247 $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
248 $tmpl = $this->prophesize(TemplateService::class);
249 $tsfe = $this->prophesize(TypoScriptFrontendController::class);
250 $tsfe->generatePageTitle()->willReturn(
'');
251 $tsfe->INTincScript_loadJSCode()->shouldBeCalled();
252 $tsfe->cObj = $cObj->reveal();
253 $tsfe->tmpl = $tmpl->reveal();
261 'meta.' => $typoScript
265 $pageRendererProphecy = $this->prophesize(PageRenderer::class);
266 GeneralUtility::setSingletonInstance(PageRenderer::class, $pageRendererProphecy->reveal());
270 $pageRendererProphecy->setMetaTag(
null,
null,
null)->shouldNotBeCalled();
276 'multi value attribute name' => [
278 'og:locale:alternate.' => [
279 'attribute' =>
'property',
289 'type' =>
'property',
290 'name' =>
'og:locale:alternate',
294 'type' =>
'property',
295 'name' =>
'og:locale:alternate',
300 'multi value attribute name (empty values are skipped)' => [
302 'og:locale:alternate.' => [
303 'attribute' =>
'property',
314 'type' =>
'property',
315 'name' =>
'og:locale:alternate',
319 'type' =>
'property',
320 'name' =>
'og:locale:alternate',
338 $cObj = $this->prophesize(ContentObjectRenderer::class);
339 $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
340 $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
341 $tmpl = $this->prophesize(TemplateService::class);
342 $tsfe = $this->prophesize(TypoScriptFrontendController::class);
343 $tsfe->generatePageTitle()->willReturn(
'');
344 $tsfe->INTincScript_loadJSCode()->shouldBeCalled();
345 $tsfe->cObj = $cObj->reveal();
346 $tsfe->tmpl = $tmpl->reveal();
354 'meta.' => $typoScript
358 $pageRendererProphecy = $this->prophesize(PageRenderer::class);
359 GeneralUtility::setSingletonInstance(PageRenderer::class, $pageRendererProphecy->reveal());
363 $pageRendererProphecy->setMetaTag($expectedTags[0][
'type'], $expectedTags[0][
'name'], $expectedTags[0][
'content'], [],
false)->shouldHaveBeenCalled();
364 $pageRendererProphecy->setMetaTag($expectedTags[1][
'type'], $expectedTags[1][
'name'], $expectedTags[1][
'content'], [],
false)->shouldHaveBeenCalled();