‪TYPO3CMS  11.5
ContentObjectRendererTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Exception;
21 use PHPUnit\Framework\MockObject\MockObject;
22 use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
23 use Prophecy\Argument;
24 use Prophecy\PhpUnit\ProphecyTrait;
25 use Prophecy\Prophecy\ObjectProphecy;
26 use Psr\Container\ContainerInterface;
27 use Psr\Http\Message\ServerRequestInterface;
28 use Psr\Log\NullLogger;
30 use ‪TYPO3\CMS\Core\Cache\Frontend\FrontendInterface as CacheFrontendInterface;
43 use TYPO3\CMS\Core\Package\PackageManager;
63 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
81 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
82 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
83 
87 class ‪ContentObjectRendererTest extends UnitTestCase
88 {
89  use ProphecyTrait;
91 
95  protected ‪$resetSingletonInstances = true;
96 
100  protected MockObject ‪$subject;
101 
105  protected MockObject ‪$frontendControllerMock;
106 
110  protected ‪$templateServiceMock;
111 
117  protected array ‪$contentObjectMap = [
118  'TEXT' => TextContentObject::class,
119  'CASE' => CaseContentObject::class,
120  'COBJ_ARRAY' => ContentObjectArrayContentObject::class,
121  'COA' => ContentObjectArrayContentObject::class,
122  'COA_INT' => ContentObjectArrayInternalContentObject::class,
123  'USER' => UserContentObject::class,
124  'USER_INT' => UserInternalContentObject::class,
125  'FILES' => FilesContentObject::class,
126  'IMAGE' => ImageContentObject::class,
127  'IMG_RESOURCE' => ImageResourceContentObject::class,
128  'CONTENT' => ContentContentObject::class,
129  'RECORDS' => RecordsContentObject::class,
130  'HMENU' => HierarchicalMenuContentObject::class,
131  'CASEFUNC' => CaseContentObject::class,
132  'LOAD_REGISTER' => LoadRegisterContentObject::class,
133  'RESTORE_REGISTER' => RestoreRegisterContentObject::class,
134  'FLUIDTEMPLATE' => FluidTemplateContentObject::class,
135  'SVG' => ScalableVectorGraphicsContentObject::class,
136  ];
137 
139  protected ObjectProphecy ‪$cacheManager;
140 
141  protected ‪$backupEnvironment = true;
142 
146  protected function ‪setUp(): void
147  {
148  parent::setUp();
149 
150  $site = $this->createSiteWithLanguage([
151  'base' => '/',
152  'languageId' => 2,
153  'locale' => 'en_UK',
154  'typo3Language' => 'default',
155  ]);
156 
157  ‪$GLOBALS['SIM_ACCESS_TIME'] = 1534278180;
158  $packageManagerMock = $this->getMockBuilder(PackageManager::class)
159  ->disableOriginalConstructor()
160  ->getMock();
161  $this->templateServiceMock =
162  $this->getMockBuilder(TemplateService::class)
163  ->setConstructorArgs([null, $packageManagerMock])
164  ->addMethods(['linkData'])
165  ->getMock();
166  $pageRepositoryMock =
167  $this->getAccessibleMock(PageRepository::class, ['getRawRecord', 'getMountPointInfo']);
168  $this->frontendControllerMock =
169  $this->getAccessibleMock(
170  TypoScriptFrontendController::class,
171  ['sL'],
172  [],
173  '',
174  false
175  );
176  $this->frontendControllerMock->_set('context', GeneralUtility::makeInstance(Context::class));
177  $this->frontendControllerMock->tmpl = ‪$this->templateServiceMock;
178  $this->frontendControllerMock->config = [];
179  $this->frontendControllerMock->page = [];
180  $this->frontendControllerMock->sys_page = $pageRepositoryMock;
181  $this->frontendControllerMock->_set('language', $site->getLanguageById(2));
183 
184  $this->cacheManager = $this->prophesize(CacheManager::class);
185  GeneralUtility::setSingletonInstance(CacheManager::class, $this->cacheManager->reveal());
186 
187  $this->subject = $this->getAccessibleMock(
188  ContentObjectRenderer::class,
189  ['getResourceFactory', 'getEnvironmentVariable'],
190  [$this->frontendControllerMock]
191  );
192 
193  $logger = $this->prophesize(Logger::class);
194  $this->subject->setLogger($logger->reveal());
195  $request = $this->prophesize(ServerRequestInterface::class);
196  $this->subject->setRequest($request->reveal());
197  $this->subject->setContentObjectClassMap($this->contentObjectMap);
198  $this->subject->start([], 'tt_content');
199  }
200 
202  // Utility functions
204 
209  {
210  return ‪$GLOBALS['TSFE'];
211  }
212 
219  protected function ‪handleCharset(string &‪$subject, string &$expected): void
220  {
221  ‪$subject = mb_convert_encoding(‪$subject, 'utf-8', 'iso-8859-1');
222  $expected = mb_convert_encoding($expected, 'utf-8', 'iso-8859-1');
223  }
224 
226  // Tests concerning the getImgResource hook
228 
232  {
233  $cacheManagerProphecy = $this->prophesize(CacheManager::class);
234  $cacheProphecy = $this->prophesize(CacheFrontendInterface::class);
235  $cacheManagerProphecy->getCache('imagesizes')->willReturn($cacheProphecy->reveal());
236  $cacheProphecy->get(Argument::cetera())->willReturn(false);
237  $cacheProphecy->set(Argument::cetera(), null)->willReturn(false);
238  GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
239 
240  $resourceFactory = $this->createMock(ResourceFactory::class);
241  $this->subject->method('getResourceFactory')->willReturn($resourceFactory);
242 
243  $className = ‪StringUtility::getUniqueId('tx_coretest');
244  $getImgResourceHookMock = $this->getMockBuilder(ContentObjectGetImageResourceHookInterface::class)
245  ->onlyMethods(['getImgResourcePostProcess'])
246  ->setMockClassName($className)
247  ->getMock();
248  $getImgResourceHookMock
249  ->expects(self::once())
250  ->method('getImgResourcePostProcess')
251  ->willReturnCallback([$this, 'isGetImgResourceHookCalledCallback']);
252  $getImgResourceHookObjects = [$getImgResourceHookMock];
253  $this->subject->_set('getImgResourceHookObjects', $getImgResourceHookObjects);
254  $this->subject->getImgResource('typo3/sysext/core/Tests/Unit/Utility/Fixtures/clear.gif', []);
255  }
256 
262  string $file,
263  array $fileArray,
264  array $imageResource,
265  ContentObjectRenderer $parent
266  ): array {
267  self::assertEquals('typo3/sysext/core/Tests/Unit/Utility/Fixtures/clear.gif', $file);
268  self::assertEquals('typo3/sysext/core/Tests/Unit/Utility/Fixtures/clear.gif', $imageResource['origFile']);
269  self::assertIsArray($fileArray);
270  self::assertInstanceOf(ContentObjectRenderer::class, $parent);
271  return $imageResource;
272  }
273 
275  // Tests related to getContentObject
277 
292  {
293  $className = TextContentObject::class;
294  $contentObjectName = 'TEST_TEXT';
295  $this->subject->registerContentObjectClass(
296  $className,
297  $contentObjectName
298  );
299  $object = $this->subject->getContentObject($contentObjectName);
300  self::assertInstanceOf($className, $object);
301  }
302 
311  {
312  $className = TextContentObject::class;
313  $contentObjectName = 'TEST_TEXT';
314  $classMap = [$contentObjectName => $className];
315  $this->subject->setContentObjectClassMap($classMap);
316  $object = $this->subject->getContentObject($contentObjectName);
317  self::assertInstanceOf($className, $object);
318  }
319 
329  {
330  $className = TextContentObject::class;
331  $contentObjectName = 'TEST_TEXT';
332  $classMap = [];
333  $this->subject->setContentObjectClassMap($classMap);
334  $classMap[$contentObjectName] = $className;
335  $object = $this->subject->getContentObject($contentObjectName);
336  self::assertNull($object);
337  }
338 
343  public function ‪willReturnNullForUnregisteredObject(): void
344  {
345  $object = $this->subject->getContentObject('FOO');
346  self::assertNull($object);
347  }
348 
354  {
355  $this->expectException(ContentRenderingException::class);
356  $this->subject->registerContentObjectClass(
357  \stdClass::class,
358  'STDCLASS'
359  );
360  $this->subject->getContentObject('STDCLASS');
361  }
362 
366  public function ‪registersAllDefaultContentObjectsDataProvider(): array
367  {
368  $dataProvider = [];
369  foreach ($this->contentObjectMap as $name => $className) {
370  $dataProvider[] = [$name, $className];
371  }
372  return $dataProvider;
373  }
374 
384  public function ‪registersAllDefaultContentObjects(
385  string $objectName,
386  string $className
387  ): void {
388  self::assertTrue(
389  is_subclass_of($className, AbstractContentObject::class)
390  );
391  if ($objectName === 'FLUIDTEMPLATE') {
392  GeneralUtility::addInstance(ContentDataProcessor::class, new ContentDataProcessor($this->prophesize(ContainerInterface::class)->reveal()));
393  }
394  $object = $this->subject->getContentObject($objectName);
395  self::assertInstanceOf($className, $object);
396  }
397 
399  // Tests concerning getQueryArguments()
401 
404  public function ‪getQueryArgumentsExcludesParameters(): void
405  {
406  $_GET = [
407  'key1' => 'value1',
408  'key2' => 'value2',
409  'key3' => [
410  'key31' => 'value31',
411  'key32' => [
412  'key321' => 'value321',
413  'key322' => 'value322',
414  ],
415  ],
416  ];
417  $getQueryArgumentsConfiguration = [];
418  $getQueryArgumentsConfiguration['exclude'] = [];
419  $getQueryArgumentsConfiguration['exclude'][] = 'key1';
420  $getQueryArgumentsConfiguration['exclude'][] = 'key3[key31]';
421  $getQueryArgumentsConfiguration['exclude'][] = 'key3[key32][key321]';
422  $getQueryArgumentsConfiguration['exclude'] = implode(',', $getQueryArgumentsConfiguration['exclude']);
423  $expectedResult = $this->‪rawUrlEncodeSquareBracketsInUrl('&key2=value2&key3[key32][key322]=value322');
424  $actualResult = $this->subject->getQueryArguments($getQueryArgumentsConfiguration);
425  self::assertEquals($expectedResult, $actualResult);
426  }
427 
434  private function ‪rawUrlEncodeSquareBracketsInUrl(string $string): string
435  {
436  return str_replace(['[', ']'], ['%5B', '%5D'], $string);
437  }
438 
440  // Tests concerning crop
442 
445  public function ‪cropIsMultibyteSafe(): void
446  {
447  self::assertEquals('бла', $this->subject->crop('бла', '3|...'));
448  }
449 
451 
453  // Tests concerning cropHTML
455 
463  public function ‪cropHTMLDataProvider(): array
464  {
465  $plainText = 'Kasper Sk' . chr(229) . 'rh' . chr(248)
466  . 'j implemented the original version of the crop function.';
467  $textWithMarkup = '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
468  . chr(229) . 'rh' . chr(248) . 'j</a> implemented</strong> the '
469  . 'original version of the crop function.';
470  $textWithEntities = 'Kasper Sk&aring;rh&oslash;j implemented the; '
471  . 'original version of the crop function.';
472  $textWithLinebreaks = "Lorem ipsum dolor sit amet,\n"
473  . "consetetur sadipscing elitr,\n"
474  . 'sed diam nonumy eirmod tempor invidunt ut labore e'
475  . 't dolore magna aliquyam';
476  $textWith2000Chars = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ips &amp;. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vesti&amp;';
477  $textWith1000AmpHtmlEntity = str_repeat('&amp;', 1000);
478  $textWith2000AmpHtmlEntity = str_repeat('&amp;', 2000);
479 
480  return [
481  'plain text; 11|...' => [
482  'Kasper Sk' . chr(229) . 'r...',
483  $plainText,
484  '11|...',
485  ],
486  'plain text; -58|...' => [
487  '...h' . chr(248) . 'j implemented the original version of '
488  . 'the crop function.',
489  $plainText,
490  '-58|...',
491  ],
492  'plain text; 4|...|1' => [
493  'Kasp...',
494  $plainText,
495  '4|...|1',
496  ],
497  'plain text; 20|...|1' => [
498  'Kasper Sk' . chr(229) . 'rh' . chr(248) . 'j...',
499  $plainText,
500  '20|...|1',
501  ],
502  'plain text; -5|...|1' => [
503  '...tion.',
504  $plainText,
505  '-5|...|1',
506  ],
507  'plain text; -49|...|1' => [
508  '...the original version of the crop function.',
509  $plainText,
510  '-49|...|1',
511  ],
512  'text with markup; 11|...' => [
513  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
514  . chr(229) . 'r...</a></strong>',
515  $textWithMarkup,
516  '11|...',
517  ],
518  'text with markup; 13|...' => [
519  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
520  . chr(229) . 'rh' . chr(248) . '...</a></strong>',
521  $textWithMarkup,
522  '13|...',
523  ],
524  'text with markup; 14|...' => [
525  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
526  . chr(229) . 'rh' . chr(248) . 'j</a>...</strong>',
527  $textWithMarkup,
528  '14|...',
529  ],
530  'text with markup; 15|...' => [
531  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
532  . chr(229) . 'rh' . chr(248) . 'j</a> ...</strong>',
533  $textWithMarkup,
534  '15|...',
535  ],
536  'text with markup; 29|...' => [
537  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
538  . chr(229) . 'rh' . chr(248) . 'j</a> implemented</strong> '
539  . 'th...',
540  $textWithMarkup,
541  '29|...',
542  ],
543  'text with markup; -58|...' => [
544  '<strong><a href="mailto:kasper@typo3.org">...h' . chr(248)
545  . 'j</a> implemented</strong> the original version of the crop '
546  . 'function.',
547  $textWithMarkup,
548  '-58|...',
549  ],
550  'text with markup 4|...|1' => [
551  '<strong><a href="mailto:kasper@typo3.org">Kasp...</a>'
552  . '</strong>',
553  $textWithMarkup,
554  '4|...|1',
555  ],
556  'text with markup; 11|...|1' => [
557  '<strong><a href="mailto:kasper@typo3.org">Kasper...</a>'
558  . '</strong>',
559  $textWithMarkup,
560  '11|...|1',
561  ],
562  'text with markup; 13|...|1' => [
563  '<strong><a href="mailto:kasper@typo3.org">Kasper...</a>'
564  . '</strong>',
565  $textWithMarkup,
566  '13|...|1',
567  ],
568  'text with markup; 14|...|1' => [
569  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
570  . chr(229) . 'rh' . chr(248) . 'j</a>...</strong>',
571  $textWithMarkup,
572  '14|...|1',
573  ],
574  'text with markup; 15|...|1' => [
575  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
576  . chr(229) . 'rh' . chr(248) . 'j</a>...</strong>',
577  $textWithMarkup,
578  '15|...|1',
579  ],
580  'text with markup; 29|...|1' => [
581  '<strong><a href="mailto:kasper@typo3.org">Kasper Sk'
582  . chr(229) . 'rh' . chr(248) . 'j</a> implemented</strong>...',
583  $textWithMarkup,
584  '29|...|1',
585  ],
586  'text with markup; -66|...|1' => [
587  '<strong><a href="mailto:kasper@typo3.org">...Sk' . chr(229)
588  . 'rh' . chr(248) . 'j</a> implemented</strong> the original v'
589  . 'ersion of the crop function.',
590  $textWithMarkup,
591  '-66|...|1',
592  ],
593  'text with entities 9|...' => [
594  'Kasper Sk...',
595  $textWithEntities,
596  '9|...',
597  ],
598  'text with entities 10|...' => [
599  'Kasper Sk&aring;...',
600  $textWithEntities,
601  '10|...',
602  ],
603  'text with entities 11|...' => [
604  'Kasper Sk&aring;r...',
605  $textWithEntities,
606  '11|...',
607  ],
608  'text with entities 13|...' => [
609  'Kasper Sk&aring;rh&oslash;...',
610  $textWithEntities,
611  '13|...',
612  ],
613  'text with entities 14|...' => [
614  'Kasper Sk&aring;rh&oslash;j...',
615  $textWithEntities,
616  '14|...',
617  ],
618  'text with entities 15|...' => [
619  'Kasper Sk&aring;rh&oslash;j ...',
620  $textWithEntities,
621  '15|...',
622  ],
623  'text with entities 16|...' => [
624  'Kasper Sk&aring;rh&oslash;j i...',
625  $textWithEntities,
626  '16|...',
627  ],
628  'text with entities -57|...' => [
629  '...j implemented the; original version of the crop function.',
630  $textWithEntities,
631  '-57|...',
632  ],
633  'text with entities -58|...' => [
634  '...&oslash;j implemented the; original version of the crop '
635  . 'function.',
636  $textWithEntities,
637  '-58|...',
638  ],
639  'text with entities -59|...' => [
640  '...h&oslash;j implemented the; original version of the crop '
641  . 'function.',
642  $textWithEntities,
643  '-59|...',
644  ],
645  'text with entities 4|...|1' => [
646  'Kasp...',
647  $textWithEntities,
648  '4|...|1',
649  ],
650  'text with entities 9|...|1' => [
651  'Kasper...',
652  $textWithEntities,
653  '9|...|1',
654  ],
655  'text with entities 10|...|1' => [
656  'Kasper...',
657  $textWithEntities,
658  '10|...|1',
659  ],
660  'text with entities 11|...|1' => [
661  'Kasper...',
662  $textWithEntities,
663  '11|...|1',
664  ],
665  'text with entities 13|...|1' => [
666  'Kasper...',
667  $textWithEntities,
668  '13|...|1',
669  ],
670  'text with entities 14|...|1' => [
671  'Kasper Sk&aring;rh&oslash;j...',
672  $textWithEntities,
673  '14|...|1',
674  ],
675  'text with entities 15|...|1' => [
676  'Kasper Sk&aring;rh&oslash;j...',
677  $textWithEntities,
678  '15|...|1',
679  ],
680  'text with entities 16|...|1' => [
681  'Kasper Sk&aring;rh&oslash;j...',
682  $textWithEntities,
683  '16|...|1',
684  ],
685  'text with entities -57|...|1' => [
686  '...implemented the; original version of the crop function.',
687  $textWithEntities,
688  '-57|...|1',
689  ],
690  'text with entities -58|...|1' => [
691  '...implemented the; original version of the crop function.',
692  $textWithEntities,
693  '-58|...|1',
694  ],
695  'text with entities -59|...|1' => [
696  '...implemented the; original version of the crop function.',
697  $textWithEntities,
698  '-59|...|1',
699  ],
700  'text with dash in html-element 28|...|1' => [
701  'Some text with a link to <link email.address@example.org - '
702  . 'mail "Open email window">my...</link>',
703  'Some text with a link to <link email.address@example.org - m'
704  . 'ail "Open email window">my email.address@example.org<'
705  . '/link> and text after it',
706  '28|...|1',
707  ],
708  'html elements with dashes in attributes' => [
709  '<em data-foo="x">foobar</em>foo',
710  '<em data-foo="x">foobar</em>foobaz',
711  '9',
712  ],
713  'html elements with iframe embedded 24|...|1' => [
714  'Text with iframe <iframe src="//what.ever/"></iframe> and...',
715  'Text with iframe <iframe src="//what.ever/">'
716  . '</iframe> and text after it',
717  '24|...|1',
718  ],
719  'html elements with script tag embedded 24|...|1' => [
720  'Text with script <script>alert(\'foo\');</script> and...',
721  'Text with script <script>alert(\'foo\');</script> '
722  . 'and text after it',
723  '24|...|1',
724  ],
725  'text with linebreaks' => [
726  "Lorem ipsum dolor sit amet,\nconsetetur sadipscing elitr,\ns"
727  . 'ed diam nonumy eirmod tempor invidunt ut labore e'
728  . 't dolore magna',
729  $textWithLinebreaks,
730  '121',
731  ],
732  'long text under the crop limit' => [
733  'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit' . ' ...',
734  $textWith2000Chars,
735  '962|...',
736  ],
737  'long text above the crop limit' => [
738  'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ips &amp;. N' . '...',
739  $textWith2000Chars,
740  '1000|...',
741  ],
742  'long text above the crop limit #2' => [
743  'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ips &amp;. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vesti&amp;' . '...',
744  $textWith2000Chars . $textWith2000Chars,
745  '2000|...',
746  ],
747  // ensure that large number of html entities do not break the the regexp splittin
748  'long text with large number of html entities' => [
749  $textWith1000AmpHtmlEntity . '...',
750  $textWith2000AmpHtmlEntity,
751  '1000|...',
752  ],
753  ];
754  }
755 
765  public function ‪cropHTML(string $expect, string $content, string $conf): void
766  {
767  $this->‪handleCharset($content, $expect);
768  self::assertSame(
769  $expect,
770  $this->subject->cropHTML($content, $conf)
771  );
772  }
773 
779  public function ‪roundDataProvider(): array
780  {
781  return [
782  // floats
783  'down' => [1.0, 1.11, []],
784  'up' => [2.0, 1.51, []],
785  'rounds up from x.50' => [2.0, 1.50, []],
786  'down with decimals' => [0.12, 0.1231, ['decimals' => 2]],
787  'up with decimals' => [0.13, 0.1251, ['decimals' => 2]],
788  'ceil' => [1.0, 0.11, ['roundType' => 'ceil']],
789  'ceil does not accept decimals' => [
790  1.0,
791  0.111,
792  [
793  'roundType' => 'ceil',
794  'decimals' => 2,
795  ],
796  ],
797  'floor' => [2.0, 2.99, ['roundType' => 'floor']],
798  'floor does not accept decimals' => [
799  2.0,
800  2.999,
801  [
802  'roundType' => 'floor',
803  'decimals' => 2,
804  ],
805  ],
806  'round, down' => [1.0, 1.11, ['roundType' => 'round']],
807  'round, up' => [2.0, 1.55, ['roundType' => 'round']],
808  'round does accept decimals' => [
809  5.56,
810  5.5555,
811  [
812  'roundType' => 'round',
813  'decimals' => 2,
814  ],
815  ],
816  // strings
817  'emtpy string' => [0.0, '', []],
818  'word string' => [0.0, 'word', []],
819  'float string' => [1.0, '1.123456789', []],
820  // other types
821  'null' => [0.0, null, []],
822  'false' => [0.0, false, []],
823  'true' => [1.0, true, []],
824  ];
825  }
826 
844  public function ‪round(float $expect, $content, array $conf): void
845  {
846  self::assertSame(
847  $expect,
848  $this->subject->_call('round', $content, $conf)
849  );
850  }
851 
855  public function ‪recursiveStdWrapProperlyRendersBasicString(): void
856  {
857  $stdWrapConfiguration = [
858  'noTrimWrap' => '|| 123|',
859  'stdWrap.' => [
860  'wrap' => '<b>|</b>',
861  ],
862  ];
863  self::assertSame(
864  '<b>Test</b> 123',
865  $this->subject->stdWrap('Test', $stdWrapConfiguration)
866  );
867  }
868 
872  public function ‪recursiveStdWrapIsOnlyCalledOnce(): void
873  {
874  $stdWrapConfiguration = [
875  'append' => 'TEXT',
876  'append.' => [
877  'data' => 'register:Counter',
878  ],
879  'stdWrap.' => [
880  'append' => 'LOAD_REGISTER',
881  'append.' => [
882  'Counter.' => [
883  'prioriCalc' => 'intval',
884  'cObject' => 'TEXT',
885  'cObject.' => [
886  'data' => 'register:Counter',
887  'wrap' => '|+1',
888  ],
889  ],
890  ],
891  ],
892  ];
893  self::assertSame(
894  'Counter:1',
895  $this->subject->stdWrap('Counter:', $stdWrapConfiguration)
896  );
897  }
898 
904  public function ‪numberFormatDataProvider(): array
905  {
906  return [
907  'testing decimals' => [
908  '0.80',
909  0.8,
910  ['decimals' => 2],
911  ],
912  'testing decimals with input as string' => [
913  '0.80',
914  '0.8',
915  ['decimals' => 2],
916  ],
917  'testing dec_point' => [
918  '0,8',
919  0.8,
920  ['decimals' => 1, 'dec_point' => ','],
921  ],
922  'testing thousands_sep' => [
923  '1.000',
924  999.99,
925  [
926  'decimals' => 0,
927  'thousands_sep.' => ['char' => 46],
928  ],
929  ],
930  'testing mixture' => [
931  '1.281.731,5',
932  1281731.45,
933  [
934  'decimals' => 1,
935  'dec_point.' => ['char' => 44],
936  'thousands_sep.' => ['char' => 46],
937  ],
938  ],
939  ];
940  }
941 
951  public function ‪numberFormat(string $expects, $content, array $conf): void
952  {
953  self::assertSame(
954  $expects,
955  $this->subject->numberFormat($content, $conf)
956  );
957  }
958 
964  public function ‪replacementDataProvider(): array
965  {
966  return [
967  'multiple replacements, including regex' => [
968  'There is an animal, an animal and an animal around the block! Yeah!',
969  'There_is_a_cat,_a_dog_and_a_tiger_in_da_hood!_Yeah!',
970  [
971  '20.' => [
972  'search' => '_',
973  'replace.' => ['char' => '32'],
974  ],
975  '120.' => [
976  'search' => 'in da hood',
977  'replace' => 'around the block',
978  ],
979  '130.' => [
980  'search' => '#a (Cat|Dog|Tiger)#i',
981  'replace' => 'an animal',
982  'useRegExp' => '1',
983  ],
984  ],
985  ],
986  'replacement with optionSplit, normal pattern' => [
987  'There1is2a3cat,3a3dog3and3a3tiger3in3da3hood!3Yeah!',
988  'There_is_a_cat,_a_dog_and_a_tiger_in_da_hood!_Yeah!',
989  [
990  '10.' => [
991  'search' => '_',
992  'replace' => '1 || 2 || 3',
993  'useOptionSplitReplace' => '1',
994  'useRegExp' => '0',
995  ],
996  ],
997  ],
998  'replacement with optionSplit, using regex' => [
999  'There is a tiny cat, a midsized dog and a big tiger in da hood! Yeah!',
1000  'There is a cat, a dog and a tiger in da hood! Yeah!',
1001  [
1002  '10.' => [
1003  'search' => '#(a) (Cat|Dog|Tiger)#i',
1004  'replace' => '${1} tiny ${2} || ${1} midsized ${2} || ${1} big ${2}',
1005  'useOptionSplitReplace' => '1',
1006  'useRegExp' => '1',
1007  ],
1008  ],
1009  ],
1010  ];
1011  }
1012 
1022  public function ‪replacement(string $expects, string $content, array $conf): void
1023  {
1024  self::assertSame(
1025  $expects,
1026  $this->subject->_call('replacement', $content, $conf)
1027  );
1028  }
1029 
1035  public function ‪calcAgeDataProvider(): array
1036  {
1037  return [
1038  'minutes' => [
1039  '2 min',
1040  120,
1041  ' min| hrs| days| yrs',
1042  ],
1043  'hours' => [
1044  '2 hrs',
1045  7200,
1046  ' min| hrs| days| yrs',
1047  ],
1048  'days' => [
1049  '7 days',
1050  604800,
1051  ' min| hrs| days| yrs',
1052  ],
1053  'day with provided singular labels' => [
1054  '1 day',
1055  86400,
1056  ' min| hrs| days| yrs| min| hour| day| year',
1057  ],
1058  'years' => [
1059  '45 yrs',
1060  1417997800,
1061  ' min| hrs| days| yrs',
1062  ],
1063  'different labels' => [
1064  '2 Minutes',
1065  120,
1066  ' Minutes| Hrs| Days| Yrs',
1067  ],
1068  'negative values' => [
1069  '-7 days',
1070  -604800,
1071  ' min| hrs| days| yrs',
1072  ],
1073  'default label values for wrong label input' => [
1074  '2 min',
1075  121,
1076  '10',
1077  ],
1078  'default singular label values for wrong label input' => [
1079  '1 year',
1080  31536000,
1081  '10',
1082  ],
1083  ];
1084  }
1085 
1095  public function ‪calcAge(string $expect, int $timestamp, string $labels): void
1096  {
1097  self::assertSame(
1098  $expect,
1099  $this->subject->calcAge($timestamp, $labels)
1100  );
1101  }
1102 
1106  public function ‪stdWrapReturnsExpectationDataProvider(): array
1107  {
1108  return [
1109  'Prevent silent bool conversion' => [
1110  '1+1',
1111  [
1112  'prioriCalc.' => [
1113  'wrap' => '|',
1114  ],
1115  ],
1116  '1+1',
1117  ],
1118  ];
1119  }
1120 
1128  public function ‪stdWrapReturnsExpectation(string $content, array $configuration, string $expectation): void
1129  {
1130  self::assertSame($expectation, $this->subject->stdWrap($content, $configuration));
1131  }
1132 
1134  {
1135  return [
1136  'ifEmpty is not called if content is present as an non-empty string' => [
1137  'content' => 'some content',
1138  'ifEmptyShouldBeCalled' => false,
1139  ],
1140  'ifEmpty is not called if content is present as the string "1"' => [
1141  'content' => '1',
1142  'ifEmptyShouldBeCalled' => false,
1143  ],
1144  'ifEmpty is called if content is present as an empty string' => [
1145  'content' => '',
1146  'ifEmptyShouldBeCalled' => true,
1147  ],
1148  'ifEmpty is called if content is present as the string "0"' => [
1149  'content' => '0',
1150  'ifEmptyShouldBeCalled' => true,
1151  ],
1152  ];
1153  }
1154 
1159  public function ‪stdWrapDoesOnlyCallIfEmptyIfTheTrimmedContentIsEmptyOrZero(string $content, bool $ifEmptyShouldBeCalled): void
1160  {
1161  $conf = [
1162  'ifEmpty.' => [
1163  'cObject' => 'TEXT',
1164  ],
1165  ];
1166 
1167  ‪$subject = $this->getAccessibleMock(ContentObjectRenderer::class, ['stdWrap_ifEmpty']);
1168  ‪$subject->expects(self::exactly(($ifEmptyShouldBeCalled ? 1 : 0)))
1169  ->method('stdWrap_ifEmpty');
1170 
1171  ‪$subject->stdWrap($content, $conf);
1172  }
1173 
1179  public function ‪substringDataProvider(): array
1180  {
1181  return [
1182  'sub -1' => ['g', 'substring', '-1'],
1183  'sub -1,0' => ['g', 'substring', '-1,0'],
1184  'sub -1,-1' => ['', 'substring', '-1,-1'],
1185  'sub -1,1' => ['g', 'substring', '-1,1'],
1186  'sub 0' => ['substring', 'substring', '0'],
1187  'sub 0,0' => ['substring', 'substring', '0,0'],
1188  'sub 0,-1' => ['substrin', 'substring', '0,-1'],
1189  'sub 0,1' => ['s', 'substring', '0,1'],
1190  'sub 1' => ['ubstring', 'substring', '1'],
1191  'sub 1,0' => ['ubstring', 'substring', '1,0'],
1192  'sub 1,-1' => ['ubstrin', 'substring', '1,-1'],
1193  'sub 1,1' => ['u', 'substring', '1,1'],
1194  'sub' => ['substring', 'substring', ''],
1195  ];
1196  }
1197 
1207  public function ‪substring(string $expect, string $content, string $conf): void
1208  {
1209  self::assertSame($expect, $this->subject->substring($content, $conf));
1210  }
1211 
1213  // Tests concerning getData()
1215 
1219  public function ‪getDataWithTypeGpDataProvider(): array
1220  {
1221  return [
1222  'Value in get-data' => ['onlyInGet', 'GetValue'],
1223  'Value in post-data' => ['onlyInPost', 'PostValue'],
1224  'Value in post-data overriding get-data' => ['inGetAndPost', 'ValueInPost'],
1225  ];
1226  }
1227 
1236  public function ‪getDataWithTypeGp(string $key, string $expectedValue): void
1237  {
1238  $_GET = [
1239  'onlyInGet' => 'GetValue',
1240  'inGetAndPost' => 'ValueInGet',
1241  ];
1242  $_POST = [
1243  'onlyInPost' => 'PostValue',
1244  'inGetAndPost' => 'ValueInPost',
1245  ];
1246  self::assertEquals($expectedValue, $this->subject->getData('gp:' . $key));
1247  }
1248 
1254  public function ‪getDataWithTypeTsfe(): void
1255  {
1256  self::assertEquals(‪$GLOBALS['TSFE']->metaCharset, $this->subject->getData('tsfe:metaCharset'));
1257  }
1258 
1264  public function ‪getDataWithTypeGetenv(): void
1265  {
1266  $envName = ‪StringUtility::getUniqueId('frontendtest');
1267  $value = ‪StringUtility::getUniqueId('someValue');
1268  putenv($envName . '=' . $value);
1269  self::assertEquals($value, $this->subject->getData('getenv:' . $envName));
1270  }
1271 
1277  public function ‪getDataWithTypeGetindpenv(): void
1278  {
1279  $this->subject->expects(self::once())->method('getEnvironmentVariable')
1280  ->with(self::equalTo('SCRIPT_FILENAME'))->willReturn('dummyPath');
1281  self::assertEquals('dummyPath', $this->subject->getData('getindpenv:SCRIPT_FILENAME'));
1282  }
1283 
1289  public function ‪getDataWithTypeField(): void
1290  {
1291  $key = 'someKey';
1292  $value = 'someValue';
1293  $field = [$key => $value];
1294 
1295  self::assertEquals($value, $this->subject->getData('field:' . $key, $field));
1296  }
1297 
1305  {
1306  $key = 'somekey|level1|level2';
1307  $value = 'somevalue';
1308  $field = ['somekey' => ['level1' => ['level2' => 'somevalue']]];
1309 
1310  self::assertEquals($value, $this->subject->getData('field:' . $key, $field));
1311  }
1312 
1314  {
1315  return [
1316  'no whitespace' => [
1317  'typoScriptPath' => 'file:current:uid',
1318  ],
1319  'always whitespace' => [
1320  'typoScriptPath' => 'file : current : uid',
1321  ],
1322  'mixed whitespace' => [
1323  'typoScriptPath' => 'file:current : uid',
1324  ],
1325  ];
1326  }
1327 
1334  public function ‪getDataWithTypeFileReturnsUidOfFileObject(string $typoScriptPath): void
1335  {
1337  $file = $this->createMock(File::class);
1338  $file->expects(self::once())->method('getUid')->willReturn($uid);
1339  $this->subject->setCurrentFile($file);
1340  self::assertEquals($uid, $this->subject->getData($typoScriptPath));
1341  }
1342 
1348  public function ‪getDataWithTypeParameters(): void
1349  {
1350  $key = ‪StringUtility::getUniqueId('someKey');
1351  $value = ‪StringUtility::getUniqueId('someValue');
1352  $this->subject->parameters[$key] = $value;
1353 
1354  self::assertEquals($value, $this->subject->getData('parameters:' . $key));
1355  }
1356 
1362  public function ‪getDataWithTypeRegister(): void
1363  {
1364  $key = ‪StringUtility::getUniqueId('someKey');
1365  $value = ‪StringUtility::getUniqueId('someValue');
1366  ‪$GLOBALS['TSFE']->register[$key] = $value;
1367 
1368  self::assertEquals($value, $this->subject->getData('register:' . $key));
1369  }
1370 
1376  public function ‪getDataWithTypeSession(): void
1377  {
1378  $frontendUser = $this->getMockBuilder(FrontendUserAuthentication::class)
1379  ->onlyMethods(['getSessionData'])
1380  ->getMock();
1381  $frontendUser->expects(self::once())->method('getSessionData')->with('myext')->willReturn([
1382  'mydata' => [
1383  'someValue' => 42,
1384  ],
1385  ]);
1386  ‪$GLOBALS['TSFE']->fe_user = $frontendUser;
1387 
1388  self::assertEquals(42, $this->subject->getData('session:myext|mydata|someValue'));
1389  }
1390 
1396  public function ‪getDataWithTypeLevel(): void
1397  {
1398  $rootline = [
1399  0 => ['uid' => 1, 'title' => 'title1'],
1400  1 => ['uid' => 2, 'title' => 'title2'],
1401  2 => ['uid' => 3, 'title' => 'title3'],
1402  ];
1403 
1404  ‪$GLOBALS['TSFE']->tmpl->rootLine = $rootline;
1405  self::assertEquals(2, $this->subject->getData('level'));
1406  }
1407 
1413  public function ‪getDataWithTypeGlobal(): void
1414  {
1415  self::assertEquals(‪$GLOBALS['TSFE']->metaCharset, $this->subject->getData('global:TSFE|metaCharset'));
1416  }
1417 
1423  public function ‪getDataWithTypeLeveltitle(): void
1424  {
1425  $rootline = [
1426  0 => ['uid' => 1, 'title' => 'title1'],
1427  1 => ['uid' => 2, 'title' => 'title2'],
1428  2 => ['uid' => 3, 'title' => ''],
1429  ];
1430 
1431  ‪$GLOBALS['TSFE']->tmpl->rootLine = $rootline;
1432  self::assertEquals('', $this->subject->getData('leveltitle:-1'));
1433  // since "title3" is not set, it will slide to "title2"
1434  self::assertEquals('title2', $this->subject->getData('leveltitle:-1,slide'));
1435  }
1436 
1442  public function ‪getDataWithTypeLevelmedia(): void
1443  {
1444  $rootline = [
1445  0 => ['uid' => 1, 'title' => 'title1', 'media' => 'media1'],
1446  1 => ['uid' => 2, 'title' => 'title2', 'media' => 'media2'],
1447  2 => ['uid' => 3, 'title' => 'title3', 'media' => ''],
1448  ];
1449 
1450  ‪$GLOBALS['TSFE']->tmpl->rootLine = $rootline;
1451  self::assertEquals('', $this->subject->getData('levelmedia:-1'));
1452  // since "title3" is not set, it will slide to "title2"
1453  self::assertEquals('media2', $this->subject->getData('levelmedia:-1,slide'));
1454  }
1455 
1461  public function ‪getDataWithTypeLeveluid(): void
1462  {
1463  $rootline = [
1464  0 => ['uid' => 1, 'title' => 'title1'],
1465  1 => ['uid' => 2, 'title' => 'title2'],
1466  2 => ['uid' => 3, 'title' => 'title3'],
1467  ];
1468 
1469  ‪$GLOBALS['TSFE']->tmpl->rootLine = $rootline;
1470  self::assertEquals(3, $this->subject->getData('leveluid:-1'));
1471  // every element will have a uid - so adding slide doesn't really make sense, just for completeness
1472  self::assertEquals(3, $this->subject->getData('leveluid:-1,slide'));
1473  }
1474 
1480  public function ‪getDataWithTypeLevelfield(): void
1481  {
1482  $rootline = [
1483  0 => ['uid' => 1, 'title' => 'title1', 'testfield' => 'field1'],
1484  1 => ['uid' => 2, 'title' => 'title2', 'testfield' => 'field2'],
1485  2 => ['uid' => 3, 'title' => 'title3', 'testfield' => ''],
1486  ];
1487 
1488  ‪$GLOBALS['TSFE']->tmpl->rootLine = $rootline;
1489  self::assertEquals('', $this->subject->getData('levelfield:-1,testfield'));
1490  self::assertEquals('field2', $this->subject->getData('levelfield:-1,testfield,slide'));
1491  }
1492 
1498  public function ‪getDataWithTypeFullrootline(): void
1499  {
1500  $rootline1 = [
1501  0 => ['uid' => 1, 'title' => 'title1', 'testfield' => 'field1'],
1502  ];
1503  $rootline2 = [
1504  0 => ['uid' => 1, 'title' => 'title1', 'testfield' => 'field1'],
1505  1 => ['uid' => 2, 'title' => 'title2', 'testfield' => 'field2'],
1506  2 => ['uid' => 3, 'title' => 'title3', 'testfield' => 'field3'],
1507  ];
1508 
1509  ‪$GLOBALS['TSFE']->tmpl->rootLine = $rootline1;
1510  ‪$GLOBALS['TSFE']->rootLine = $rootline2;
1511  self::assertEquals('field2', $this->subject->getData('fullrootline:-1,testfield'));
1512  }
1513 
1519  public function ‪getDataWithTypeDate(): void
1520  {
1521  $format = 'Y-M-D';
1522  $defaultFormat = 'd/m Y';
1523 
1524  self::assertEquals(date($format, ‪$GLOBALS['EXEC_TIME']), $this->subject->getData('date:' . $format));
1525  self::assertEquals(date($defaultFormat, ‪$GLOBALS['EXEC_TIME']), $this->subject->getData('date'));
1526  }
1527 
1533  public function ‪getDataWithTypePage(): void
1534  {
1535  $uid = random_int(0, mt_getrandmax());
1536  ‪$GLOBALS['TSFE']->page['uid'] = $uid;
1537  self::assertEquals($uid, $this->subject->getData('page:uid'));
1538  }
1539 
1545  public function ‪getDataWithTypeCurrent(): void
1546  {
1547  $key = ‪StringUtility::getUniqueId('someKey');
1548  $value = ‪StringUtility::getUniqueId('someValue');
1549  $this->subject->data[$key] = $value;
1550  $this->subject->currentValKey = $key;
1551  self::assertEquals($value, $this->subject->getData('current'));
1552  }
1553 
1557  public function ‪getDataWithTypeDbReturnsCorrectTitle()
1558  {
1559  $dummyRecord = ['uid' => 5, 'title' => 'someTitle'];
1560  ‪$GLOBALS['TSFE']->sys_page->expects(self::once())->method('getRawRecord')->with('tt_content', '106')->willReturn($dummyRecord);
1561  self::assertSame('someTitle', $this->subject->getData('db:tt_content:106:title'));
1562  }
1563 
1564  public function ‪getDataWithTypeDbDataProvider(): array
1565  {
1566  return [
1567  'identifier with missing table, uid and column' => [
1568  'identifier' => 'db',
1569  'expectsMethodCall' => self::never(),
1570  ],
1571  'identifier with empty table, missing uid and column' => [
1572  'identifier' => 'db:',
1573  'expectsMethodCall' => self::never(),
1574  ],
1575  'identifier with missing table and column' => [
1576  'identifier' => 'db:tt_content',
1577  'expectsMethodCall' => self::never(),
1578  ],
1579  'identifier with empty table and missing uid and column' => [
1580  'identifier' => 'db:tt_content:',
1581  'expectsMethodCall' => self::never(),
1582  ],
1583  'identifier with empty uid and missing column' => [
1584  'identifier' => 'db:tt_content:106',
1585  'expectsMethodCall' => self::once(),
1586  ],
1587  'identifier with empty uid and column' => [
1588  'identifier' => 'db:tt_content:106:',
1589  'expectsMethodCall' => self::once(),
1590  ],
1591  'identifier with empty uid and not existing column' => [
1592  'identifier' => 'db:tt_content:106:not_existing_column',
1593  'expectsMethodCall' => self::once(),
1594  ],
1595  ];
1596  }
1597 
1604  public function ‪getDataWithTypeDbReturnsEmptyStringOnInvalidIdentifiers(string $identifier, InvocationOrder $expectsMethodCall): void
1605  {
1606  $dummyRecord = ['uid' => 5, 'title' => 'someTitle'];
1607  ‪$GLOBALS['TSFE']->sys_page->expects($expectsMethodCall)->method('getRawRecord')->with('tt_content', '106')->willReturn($dummyRecord);
1608  self::assertSame('', $this->subject->getData($identifier));
1609  }
1610 
1616  public function ‪getDataWithTypeLll(): void
1617  {
1618  $key = ‪StringUtility::getUniqueId('someKey');
1619  $value = ‪StringUtility::getUniqueId('someValue');
1620  ‪$GLOBALS['TSFE']->expects(self::once())->method('sL')->with('LLL:' . $key)->willReturn($value);
1621  self::assertEquals($value, $this->subject->getData('lll:' . $key));
1622  }
1623 
1629  public function ‪getDataWithTypePath(): void
1630  {
1631  $filenameIn = 'typo3/sysext/frontend/Public/Icons/Extension.svg';
1632  self::assertEquals($filenameIn, $this->subject->getData('path:' . $filenameIn));
1633  }
1634 
1640  public function ‪getDataWithTypeContext(): void
1641  {
1642  $context = new Context([
1643  'workspace' => new WorkspaceAspect(3),
1644  'frontend.user' => new UserAspect(new FrontendUserAuthentication(), [0, -1]),
1645  ]);
1646  GeneralUtility::setSingletonInstance(Context::class, $context);
1647  self::assertEquals(3, $this->subject->getData('context:workspace:id'));
1648  self::assertEquals('0,-1', $this->subject->getData('context:frontend.user:groupIds'));
1649  self::assertFalse($this->subject->getData('context:frontend.user:isLoggedIn'));
1650  self::assertSame('', $this->subject->getData('context:frontend.user:foozball'));
1651  }
1652 
1658  public function ‪getDataWithTypeSite(): void
1659  {
1660  $site = new Site('my-site', 123, [
1661  'base' => 'http://example.com',
1662  'custom' => [
1663  'config' => [
1664  'nested' => 'yeah',
1665  ],
1666  ],
1667  ]);
1668  $this->frontendControllerMock->_set('site', $site);
1669  self::assertEquals('http://example.com', $this->subject->getData('site:base'));
1670  self::assertEquals('yeah', $this->subject->getData('site:custom.config.nested'));
1671  }
1672 
1678  public function ‪getDataWithTypeSiteWithBaseVariants(): void
1679  {
1680  $packageManager = new PackageManager(new DependencyOrderingService());
1681  GeneralUtility::addInstance(ProviderConfigurationLoader::class, new ProviderConfigurationLoader(
1682  $packageManager,
1683  new NullFrontend('core'),
1684  'ExpressionLanguageProviders'
1685  ));
1686  putenv('LOCAL_DEVELOPMENT=1');
1687 
1688  $site = new Site('my-site', 123, [
1689  'base' => 'http://prod.com',
1690  'baseVariants' => [
1691  [
1692  'base' => 'http://staging.com',
1693  'condition' => 'applicationContext == "Production/Staging"',
1694  ],
1695  [
1696  'base' => 'http://dev.com',
1697  'condition' => 'getenv("LOCAL_DEVELOPMENT") == 1',
1698  ],
1699  ],
1700  ]);
1701 
1702  $this->frontendControllerMock->_set('site', $site);
1703  self::assertEquals('http://dev.com', $this->subject->getData('site:base'));
1704  }
1705 
1711  public function ‪getDataWithTypeSiteLanguage(): void
1712  {
1713  $site = $this->createSiteWithLanguage([
1714  'base' => '/',
1715  'languageId' => 1,
1716  'locale' => 'de_DE',
1717  'title' => 'languageTitle',
1718  'navigationTitle' => 'German',
1719  ]);
1720  $language = $site->getLanguageById(1);
1721  $this->frontendControllerMock->_set('language', $language);
1722  self::assertEquals('German', $this->subject->getData('siteLanguage:navigationTitle'));
1723  }
1724 
1730  public function ‪getDataWithTypeParentRecordNumber(): void
1731  {
1732  $recordNumber = random_int(0, mt_getrandmax());
1733  $this->subject->parentRecordNumber = $recordNumber;
1734  self::assertEquals($recordNumber, $this->subject->getData('cobj:parentRecordNumber'));
1735  }
1736 
1742  public function ‪getDataWithTypeDebugRootline(): void
1743  {
1744  $rootline = [
1745  0 => ['uid' => 1, 'title' => 'title1'],
1746  1 => ['uid' => 2, 'title' => 'title2'],
1747  2 => ['uid' => 3, 'title' => ''],
1748  ];
1749  $expectedResult = 'array(3items)0=>array(2items)uid=>1(integer)title=>"title1"(6chars)1=>array(2items)uid=>2(integer)title=>"title2"(6chars)2=>array(2items)uid=>3(integer)title=>""(0chars)';
1750  ‪$GLOBALS['TSFE']->tmpl->rootLine = $rootline;
1751 
1753  $result = $this->subject->getData('debug:rootLine');
1754  $cleanedResult = str_replace(["\r", "\n", "\t", ' '], '', $result);
1755 
1756  self::assertEquals($expectedResult, $cleanedResult);
1757  }
1758 
1764  public function ‪getDataWithTypeDebugFullRootline(): void
1765  {
1766  $rootline = [
1767  0 => ['uid' => 1, 'title' => 'title1'],
1768  1 => ['uid' => 2, 'title' => 'title2'],
1769  2 => ['uid' => 3, 'title' => ''],
1770  ];
1771  $expectedResult = 'array(3items)0=>array(2items)uid=>1(integer)title=>"title1"(6chars)1=>array(2items)uid=>2(integer)title=>"title2"(6chars)2=>array(2items)uid=>3(integer)title=>""(0chars)';
1772  ‪$GLOBALS['TSFE']->rootLine = $rootline;
1773 
1775  $result = $this->subject->getData('debug:fullRootLine');
1776  $cleanedResult = str_replace(["\r", "\n", "\t", ' '], '', $result);
1777 
1778  self::assertEquals($expectedResult, $cleanedResult);
1779  }
1780 
1786  public function ‪getDataWithTypeDebugData(): void
1787  {
1788  $key = ‪StringUtility::getUniqueId('someKey');
1789  $value = ‪StringUtility::getUniqueId('someValue');
1790  $this->subject->data = [$key => $value];
1791 
1792  $expectedResult = 'array(1item)' . $key . '=>"' . $value . '"(' . strlen($value) . 'chars)';
1793 
1795  $result = $this->subject->getData('debug:data');
1796  $cleanedResult = str_replace(["\r", "\n", "\t", ' '], '', $result);
1797 
1798  self::assertEquals($expectedResult, $cleanedResult);
1799  }
1800 
1806  public function ‪getDataWithTypeDebugRegister(): void
1807  {
1808  $key = ‪StringUtility::getUniqueId('someKey');
1809  $value = ‪StringUtility::getUniqueId('someValue');
1810  ‪$GLOBALS['TSFE']->register = [$key => $value];
1811 
1812  $expectedResult = 'array(1item)' . $key . '=>"' . $value . '"(' . strlen($value) . 'chars)';
1813 
1815  $result = $this->subject->getData('debug:register');
1816  $cleanedResult = str_replace(["\r", "\n", "\t", ' '], '', $result);
1817 
1818  self::assertEquals($expectedResult, $cleanedResult);
1819  }
1820 
1826  public function ‪getDataWithTypeDebugPage(): void
1827  {
1828  $uid = random_int(0, mt_getrandmax());
1829  ‪$GLOBALS['TSFE']->page = ['uid' => $uid];
1830 
1831  $expectedResult = 'array(1item)uid=>' . $uid . '(integer)';
1832 
1834  $result = $this->subject->getData('debug:page');
1835  $cleanedResult = str_replace(["\r", "\n", "\t", ' '], '', $result);
1836 
1837  self::assertEquals($expectedResult, $cleanedResult);
1838  }
1839 
1843  public function ‪aTagParamsHasLeadingSpaceIfNotEmpty(): void
1844  {
1845  $aTagParams = $this->subject->getATagParams(['ATagParams' => 'data-test="testdata"']);
1846  self::assertEquals(' data-test="testdata"', $aTagParams);
1847  }
1848 
1853  {
1854  ‪$GLOBALS['TSFE']->config['config']['ATagParams'] = 'data-global="dataglobal"';
1855  $aTagParams = $this->subject->getATagParams(['ATagParams' => 'data-test="testdata"']);
1856  self::assertEquals(' data-global="dataglobal" data-test="testdata"', $aTagParams);
1857  }
1858 
1862  public function ‪aTagParamsHasNoLeadingSpaceIfEmpty(): void
1863  {
1864  // make sure global ATagParams are empty
1865  ‪$GLOBALS['TSFE']->config['config']['ATagParams'] = '';
1866  $aTagParams = $this->subject->getATagParams(['ATagParams' => '']);
1867  self::assertEquals('', $aTagParams);
1868  }
1869 
1873  public function ‪renderingContentObjectThrowsException(): void
1874  {
1875  $this->expectException(\LogicException::class);
1876  $this->expectExceptionCode(1414513947);
1877  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture(false);
1878  $this->subject->render($contentObjectFixture, []);
1879  }
1880 
1885  {
1887  new ApplicationContext('Production'),
1888  true,
1889  false,
1894  ‪Environment::getBackendPath() . '/index.php',
1895  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
1896  );
1897  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture();
1898  $this->subject->render($contentObjectFixture, []);
1899  }
1900 
1905  {
1906  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture();
1907 
1908  $configuration = [
1909  'exceptionHandler' => '1',
1910  ];
1911  $this->subject->render($contentObjectFixture, $configuration);
1912  }
1913 
1918  {
1919  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture();
1920 
1921  $this->frontendControllerMock->config['config']['contentObjectExceptionHandler'] = '1';
1922  $this->subject->render($contentObjectFixture, []);
1923  }
1924 
1929  {
1930  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture(false);
1931  $this->expectException(\LogicException::class);
1932  $this->expectExceptionCode(1414513947);
1933  $this->frontendControllerMock->config['config']['contentObjectExceptionHandler'] = '1';
1934  $configuration = [
1935  'exceptionHandler' => '0',
1936  ];
1937  $this->subject->render($contentObjectFixture, $configuration);
1938  }
1939 
1943  public function ‪renderedErrorMessageCanBeCustomized(): void
1944  {
1945  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture();
1946 
1947  $configuration = [
1948  'exceptionHandler' => '1',
1949  'exceptionHandler.' => [
1950  'errorMessage' => 'New message for testing',
1951  ],
1952  ];
1953 
1954  self::assertSame('New message for testing', $this->subject->render($contentObjectFixture, $configuration));
1955  }
1956 
1961  {
1962  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture();
1963 
1964  $this->frontendControllerMock
1965  ->config['config']['contentObjectExceptionHandler.'] = [
1966  'errorMessage' => 'Global message for testing',
1967  ];
1968  $configuration = [
1969  'exceptionHandler' => '1',
1970  'exceptionHandler.' => [
1971  'errorMessage' => 'New message for testing',
1972  ],
1973  ];
1974 
1975  self::assertSame('New message for testing', $this->subject->render($contentObjectFixture, $configuration));
1976  }
1977 
1982  {
1983  $contentObjectFixture = $this->‪createContentObjectThrowingExceptionFixture();
1984 
1985  $configuration = [
1986  'exceptionHandler' => '1',
1987  'exceptionHandler.' => [
1988  'ignoreCodes.' => ['10.' => '1414513947'],
1989  ],
1990  ];
1991  $this->expectException(\LogicException::class);
1992  $this->expectExceptionCode(1414513947);
1993  $this->subject->render($contentObjectFixture, $configuration);
1994  }
1995 
1999  protected function ‪createContentObjectThrowingExceptionFixture(bool $addProductionExceptionHandlerInstance = true)
2000  {
2001  $contentObjectFixture = $this->getMockBuilder(AbstractContentObject::class)
2002  ->setConstructorArgs([$this->subject])
2003  ->getMock();
2004  $contentObjectFixture->expects(self::once())
2005  ->method('render')
2006  ->willReturnCallback(static function () {
2007  throw new \LogicException('Exception during rendering', 1414513947);
2008  });
2009  if ($addProductionExceptionHandlerInstance) {
2010  GeneralUtility::addInstance(
2011  ProductionExceptionHandler::class,
2012  new ProductionExceptionHandler(new Context(), new Random(), new NullLogger())
2013  );
2014  }
2015  return $contentObjectFixture;
2016  }
2017 
2021  protected function ‪getLibParseFunc(): array
2022  {
2023  return [
2024  'makelinks' => '1',
2025  'makelinks.' => [
2026  'http.' => [
2027  'keep' => '{$styles.content.links.keep}',
2028  'extTarget' => '',
2029  'mailto.' => [
2030  'keep' => 'path',
2031  ],
2032  ],
2033  ],
2034  'tags' => [
2035  'link' => 'TEXT',
2036  'link.' => [
2037  'current' => '1',
2038  'typolink.' => [
2039  'parameter.' => [
2040  'data' => 'parameters : allParams',
2041  ],
2042  ],
2043  'parseFunc.' => [
2044  'constants' => '1',
2045  ],
2046  ],
2047  ],
2048 
2049  'allowTags' => 'a, abbr, acronym, address, article, aside, b, bdo, big, blockquote, br, caption, center, cite, code, col, colgroup, dd, del, dfn, dl, div, dt, em, font, footer, header, h1, h2, h3, h4, h5, h6, hr, i, img, ins, kbd, label, li, link, meta, nav, ol, p, pre, q, samp, sdfield, section, small, span, strike, strong, style, sub, sup, table, thead, tbody, tfoot, td, th, tr, title, tt, u, ul, var',
2050  'denyTags' => '*',
2051  'sword' => '<span class="csc-sword">|</span>',
2052  'constants' => '1',
2053  'nonTypoTagStdWrap.' => [
2054  'HTMLparser' => '1',
2055  'HTMLparser.' => [
2056  'keepNonMatchedTags' => '1',
2057  'htmlSpecialChars' => '2',
2058  ],
2059  ],
2060  ];
2061  }
2062 
2063  public function ‪httpMakelinksDataProvider(): array
2064  {
2065  return [
2066  'http link' => [
2067  'Some text with a link http://example.com',
2068  [
2069  ],
2070  'Some text with a link <a href="http://example.com">example.com</a>',
2071  ],
2072  'http link with path' => [
2073  'Some text with a link http://example.com/path/to/page',
2074  [
2075  ],
2076  'Some text with a link <a href="http://example.com/path/to/page">example.com</a>',
2077  ],
2078  'http link with query parameter' => [
2079  'Some text with a link http://example.com?foo=bar',
2080  [
2081  ],
2082  'Some text with a link <a href="http://example.com?foo=bar">example.com</a>',
2083  ],
2084  'http link with question mark' => [
2085  'Some text with a link http://example.com?',
2086  [
2087  ],
2088  'Some text with a link <a href="http://example.com">example.com</a>?',
2089  ],
2090  'http link with period' => [
2091  'Some text with a link http://example.com.',
2092  [
2093  ],
2094  'Some text with a link <a href="http://example.com">example.com</a>.',
2095  ],
2096  'http link with fragment' => [
2097  'Some text with a link http://example.com#',
2098  [
2099  ],
2100  'Some text with a link <a href="http://example.com#">example.com</a>',
2101  ],
2102  'http link with query parameter and fragment' => [
2103  'Some text with a link http://example.com?foo=bar#top',
2104  [
2105  ],
2106  'Some text with a link <a href="http://example.com?foo=bar#top">example.com</a>',
2107  ],
2108  'http link with query parameter and keep scheme' => [
2109  'Some text with a link http://example.com/path/to/page?foo=bar',
2110  [
2111  'keep' => 'scheme',
2112  ],
2113  'Some text with a link <a href="http://example.com/path/to/page?foo=bar">http://example.com</a>',
2114  ],
2115  'http link with query parameter and keep path' => [
2116  'Some text with a link http://example.com/path/to/page?foo=bar',
2117  [
2118  'keep' => 'path',
2119  ],
2120  'Some text with a link <a href="http://example.com/path/to/page?foo=bar">example.com/path/to/page</a>',
2121  ],
2122  'http link with query parameter and keep path with trailing slash' => [
2123  'Some text with a link http://example.com/path/to/page/?foo=bar',
2124  [
2125  'keep' => 'path',
2126  ],
2127  'Some text with a link <a href="http://example.com/path/to/page/?foo=bar">example.com/path/to/page/</a>',
2128  ],
2129  'http link with trailing slash and keep path with trailing slash' => [
2130  'Some text with a link http://example.com/',
2131  [
2132  'keep' => 'path',
2133  ],
2134  'Some text with a link <a href="http://example.com/">example.com</a>',
2135  ],
2136  'http link with query parameter and keep scheme,path' => [
2137  'Some text with a link http://example.com/path/to/page?foo=bar',
2138  [
2139  'keep' => 'scheme,path',
2140  ],
2141  'Some text with a link <a href="http://example.com/path/to/page?foo=bar">http://example.com/path/to/page</a>',
2142  ],
2143  'http link with multiple query parameters' => [
2144  'Some text with a link http://example.com?foo=bar&fuz=baz',
2145  [
2146  'keep' => 'scheme,path,query',
2147  ],
2148  'Some text with a link <a href="http://example.com?foo=bar&amp;fuz=baz">http://example.com?foo=bar&fuz=baz</a>',
2149  ],
2150  'http link with query parameter and keep scheme,path,query' => [
2151  'Some text with a link http://example.com/path/to/page?foo=bar',
2152  [
2153  'keep' => 'scheme,path,query',
2154  ],
2155  'Some text with a link <a href="http://example.com/path/to/page?foo=bar">http://example.com/path/to/page?foo=bar</a>',
2156  ],
2157  'https link' => [
2158  'Some text with a link https://example.com',
2159  [
2160  ],
2161  'Some text with a link <a href="https://example.com">example.com</a>',
2162  ],
2163  'http link with www' => [
2164  'Some text with a link http://www.example.com',
2165  [
2166  ],
2167  'Some text with a link <a href="http://www.example.com">www.example.com</a>',
2168  ],
2169  'https link with www' => [
2170  'Some text with a link https://www.example.com',
2171  [
2172  ],
2173  'Some text with a link <a href="https://www.example.com">www.example.com</a>',
2174  ],
2175  ];
2176  }
2177 
2182  public function ‪httpMakelinksReturnsLink(string $data, array $configuration, string $expectedResult): void
2183  {
2184  self::assertSame($expectedResult, $this->subject->http_makelinks($data, $configuration));
2185  }
2186 
2187  public function ‪invalidHttpMakelinksDataProvider(): array
2188  {
2189  return [
2190  'only http protocol' => [
2191  'http://',
2192  [
2193  ],
2194  'http://',
2195  ],
2196  'only https protocol' => [
2197  'https://',
2198  [
2199  ],
2200  'https://',
2201  ],
2202  'ftp link' => [
2203  'ftp://user@password:example.com',
2204  [
2205  ],
2206  'ftp://user@password:example.com',
2207  ],
2208  ];
2209  }
2210 
2215  public function ‪httpMakelinksReturnsNoLink(string $data, array $configuration, string $expectedResult): void
2216  {
2217  self::assertSame($expectedResult, $this->subject->http_makelinks($data, $configuration));
2218  }
2219 
2220  public function ‪mailtoMakelinksDataProvider(): array
2221  {
2222  return [
2223  'mailto link' => [
2224  'Some text with an email address mailto:john@example.com',
2225  [
2226  ],
2227  'Some text with an email address <a href="mailto:john@example.com">john@example.com</a>',
2228  ],
2229  'mailto link with subject parameter' => [
2230  'Some text with an email address mailto:john@example.com?subject=hi',
2231  [
2232  ],
2233  'Some text with an email address <a href="mailto:john@example.com?subject=hi">john@example.com</a>',
2234  ],
2235  'mailto link with multiple parameters' => [
2236  'Some text with an email address mailto:john@example.com?subject=Greetings&body=Hi+John',
2237  [
2238  ],
2239  'Some text with an email address <a href="mailto:john@example.com?subject=Greetings&amp;body=Hi+John">john@example.com</a>',
2240  ],
2241  'mailto link with question mark' => [
2242  'Some text with an email address mailto:john@example.com?',
2243  [
2244  ],
2245  'Some text with an email address <a href="mailto:john@example.com">john@example.com</a>?',
2246  ],
2247  'mailto link with period' => [
2248  'Some text with an email address mailto:john@example.com.',
2249  [
2250  ],
2251  'Some text with an email address <a href="mailto:john@example.com">john@example.com</a>.',
2252  ],
2253  'mailto link with wrap' => [
2254  'Some text with an email address mailto:john@example.com.',
2255  [
2256  'wrap' => '<span>|</span>',
2257  ],
2258  'Some text with an email address <span><a href="mailto:john@example.com">john@example.com</a></span>.',
2259  ],
2260  'mailto link with ATagBeforeWrap' => [
2261  'Some text with an email address mailto:john@example.com.',
2262  [
2263  'wrap' => '<span>|</span>',
2264  'ATagBeforeWrap' => 1,
2265  ],
2266  'Some text with an email address <a href="mailto:john@example.com"><span>john@example.com</span></a>.',
2267  ],
2268  'mailto link with ATagParams' => [
2269  'Some text with an email address mailto:john@example.com.',
2270  [
2271  'ATagParams' => 'class="email"',
2272  ],
2273  'Some text with an email address <a href="mailto:john@example.com" class="email">john@example.com</a>.',
2274  ],
2275  ];
2276  }
2277 
2282  public function ‪mailtoMakelinksReturnsMailToLink(string $data, array $configuration, string $expectedResult): void
2283  {
2284  self::assertSame($expectedResult, $this->subject->mailto_makelinks($data, $configuration));
2285  }
2286 
2290  public function ‪mailtoMakelinksReturnsNoMailToLink(): void
2291  {
2292  self::assertSame('mailto:', $this->subject->mailto_makelinks('mailto:', []));
2293  }
2294 
2299  {
2300  return [
2301  'Link to url' => [
2302  'TYPO3',
2303  [
2304  'directImageLink' => false,
2305  'parameter' => 'http://typo3.org',
2306  ],
2307  '<a href="http://typo3.org">TYPO3</a>',
2308  ],
2309  'Link to url without schema' => [
2310  'TYPO3',
2311  [
2312  'directImageLink' => false,
2313  'parameter' => 'typo3.org',
2314  ],
2315  '<a href="http://typo3.org">TYPO3</a>',
2316  ],
2317  'Link to url without link text' => [
2318  '',
2319  [
2320  'directImageLink' => false,
2321  'parameter' => 'http://typo3.org',
2322  ],
2323  '<a href="http://typo3.org">http://typo3.org</a>',
2324  ],
2325  'Link to url with attributes' => [
2326  'TYPO3',
2327  [
2328  'parameter' => 'http://typo3.org',
2329  'ATagParams' => 'class="url-class"',
2330  'extTarget' => '_blank',
2331  'title' => 'Open new window',
2332  ],
2333  '<a href="http://typo3.org" title="Open new window" target="_blank" class="url-class" rel="noreferrer">TYPO3</a>',
2334  ],
2335  'Link to url with attributes and custom target name' => [
2336  'TYPO3',
2337  [
2338  'parameter' => 'http://typo3.org',
2339  'ATagParams' => 'class="url-class"',
2340  'extTarget' => 'someTarget',
2341  'title' => 'Open new window',
2342  ],
2343  '<a href="http://typo3.org" title="Open new window" target="someTarget" class="url-class" rel="noreferrer">TYPO3</a>',
2344  ],
2345  'Link to url with attributes in parameter' => [
2346  'TYPO3',
2347  [
2348  'parameter' => 'http://typo3.org _blank url-class "Open new window"',
2349  ],
2350  '<a href="http://typo3.org" title="Open new window" target="_blank" class="url-class" rel="noreferrer">TYPO3</a>',
2351  ],
2352  'Link to url with attributes in parameter and custom target name' => [
2353  'TYPO3',
2354  [
2355  'parameter' => 'http://typo3.org someTarget url-class "Open new window"',
2356  ],
2357  '<a href="http://typo3.org" title="Open new window" target="someTarget" class="url-class" rel="noreferrer">TYPO3</a>',
2358  ],
2359  'Link to url with script tag' => [
2360  '',
2361  [
2362  'directImageLink' => false,
2363  'parameter' => 'http://typo3.org<script>alert(123)</script>',
2364  ],
2365  '<a href="http://typo3.org&lt;script&gt;alert(123)&lt;/script&gt;">http://typo3.org&lt;script&gt;alert(123)&lt;/script&gt;</a>',
2366  ],
2367  'Link to email address' => [
2368  'Email address',
2369  [
2370  'parameter' => 'foo@bar.org',
2371  ],
2372  '<a href="mailto:foo@bar.org">Email address</a>',
2373  ],
2374  'Link to email address without link text' => [
2375  '',
2376  [
2377  'parameter' => 'foo@bar.org',
2378  ],
2379  '<a href="mailto:foo@bar.org">foo@bar.org</a>',
2380  ],
2381  'Link to email with attributes' => [
2382  'Email address',
2383  [
2384  'parameter' => 'foo@bar.org',
2385  'ATagParams' => 'class="email-class"',
2386  'title' => 'Write an email',
2387  ],
2388  '<a href="mailto:foo@bar.org" title="Write an email" class="email-class">Email address</a>',
2389  ],
2390  'Link to email with attributes in parameter' => [
2391  'Email address',
2392  [
2393  'parameter' => 'foo@bar.org - email-class "Write an email"',
2394  ],
2395  '<a href="mailto:foo@bar.org" title="Write an email" class="email-class">Email address</a>',
2396  ],
2397  'Link url using stdWrap' => [
2398  'TYPO3',
2399  [
2400  'parameter' => 'http://typo3.org',
2401  'parameter.' => [
2402  'cObject' => 'TEXT',
2403  'cObject.' => [
2404  'value' => 'http://typo3.com',
2405  ],
2406  ],
2407  ],
2408  '<a href="http://typo3.com">TYPO3</a>',
2409  ],
2410  'Link url using stdWrap with class attribute in parameter' => [
2411  'TYPO3',
2412  [
2413  'parameter' => 'http://typo3.org - url-class',
2414  'parameter.' => [
2415  'cObject' => 'TEXT',
2416  'cObject.' => [
2417  'value' => 'http://typo3.com',
2418  ],
2419  ],
2420  ],
2421  '<a href="http://typo3.com" class="url-class">TYPO3</a>',
2422  ],
2423  'Link url using stdWrap with class attribute in parameter and overridden target' => [
2424  'TYPO3',
2425  [
2426  'parameter' => 'http://typo3.org default-target url-class',
2427  'parameter.' => [
2428  'cObject' => 'TEXT',
2429  'cObject.' => [
2430  'value' => 'http://typo3.com new-target different-url-class',
2431  ],
2432  ],
2433  ],
2434  '<a href="http://typo3.com" target="new-target" class="different-url-class" rel="noreferrer">TYPO3</a>',
2435  ],
2436  'Link url using stdWrap with class attribute in parameter and overridden target and returnLast' => [
2437  'TYPO3',
2438  [
2439  'parameter' => 'http://typo3.org default-target url-class',
2440  'parameter.' => [
2441  'cObject' => 'TEXT',
2442  'cObject.' => [
2443  'value' => 'http://typo3.com new-target different-url-class',
2444  ],
2445  ],
2446  'returnLast' => 'url',
2447  ],
2448  'http://typo3.com',
2449  ],
2450  ];
2451  }
2452 
2460  public function ‪typolinkReturnsCorrectLinksForEmailsAndUrls(string $linkText, array $configuration, string $expectedResult): void
2461  {
2462  $packageManagerMock = $this->getMockBuilder(PackageManager::class)
2463  ->disableOriginalConstructor()
2464  ->getMock();
2465  $templateServiceObjectMock = $this->getMockBuilder(TemplateService::class)
2466  ->setConstructorArgs([null, $packageManagerMock])
2467  ->addMethods(['dummy'])
2468  ->getMock();
2469  $templateServiceObjectMock->setup = [
2470  'lib.' => [
2471  'parseFunc.' => $this->‪getLibParseFunc(),
2472  ],
2473  ];
2474  $typoScriptFrontendControllerMockObject = $this->createMock(TypoScriptFrontendController::class);
2475  $typoScriptFrontendControllerMockObject->config = [
2476  'config' => [],
2477  ];
2478  $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock;
2479  ‪$GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject;
2480 
2481  $this->cacheManager->getCache('runtime')->willReturn(new NullFrontend('dummy'));
2482  $this->cacheManager->getCache('core')->willReturn(new NullFrontend('runtime'));
2483 
2484  GeneralUtility::setSingletonInstance(
2485  SiteConfiguration::class,
2486  new SiteConfiguration(‪Environment::getConfigPath() . '/sites', new NullFrontend('dummy'))
2487  );
2488 
2489  $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject);
2490 
2491  self::assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
2492  }
2493 
2503  array $settings,
2504  string $linkText,
2505  string $mailAddress,
2506  string $expected
2507  ): void {
2508  $this->‪getFrontendController()->spamProtectEmailAddresses = $settings['spamProtectEmailAddresses'];
2509  $this->‪getFrontendController()->config['config'] = $settings;
2510  $typoScript = ['parameter' => $mailAddress];
2511 
2512  self::assertEquals($expected, $this->subject->typoLink($linkText, $typoScript));
2513  }
2514 
2519  {
2520  return [
2521  'plain mail without mailto scheme' => [
2522  [
2523  'spamProtectEmailAddresses' => '',
2524  'spamProtectEmailAddresses_atSubst' => '',
2525  'spamProtectEmailAddresses_lastDotSubst' => '',
2526  ],
2527  'some.body@test.typo3.org',
2528  'some.body@test.typo3.org',
2529  '<a href="mailto:some.body@test.typo3.org">some.body@test.typo3.org</a>',
2530  ],
2531  'plain mail with mailto scheme' => [
2532  [
2533  'spamProtectEmailAddresses' => '',
2534  'spamProtectEmailAddresses_atSubst' => '',
2535  'spamProtectEmailAddresses_lastDotSubst' => '',
2536  ],
2537  'some.body@test.typo3.org',
2538  'mailto:some.body@test.typo3.org',
2539  '<a href="mailto:some.body@test.typo3.org">some.body@test.typo3.org</a>',
2540  ],
2541  'plain with at and dot substitution' => [
2542  [
2543  'spamProtectEmailAddresses' => '0',
2544  'spamProtectEmailAddresses_atSubst' => '(at)',
2545  'spamProtectEmailAddresses_lastDotSubst' => '(dot)',
2546  ],
2547  'some.body@test.typo3.org',
2548  'mailto:some.body@test.typo3.org',
2549  '<a href="mailto:some.body@test.typo3.org">some.body@test.typo3.org</a>',
2550  ],
2551  'mono-alphabetic substitution offset +1' => [
2552  [
2553  'spamProtectEmailAddresses' => '1',
2554  'spamProtectEmailAddresses_atSubst' => '',
2555  'spamProtectEmailAddresses_lastDotSubst' => '',
2556  ],
2557  'some.body@test.typo3.org',
2558  'mailto:some.body@test.typo3.org',
2559  '<a href="#" data-mailto-token="nbjmup+tpnf/cpezAuftu/uzqp4/psh" data-mailto-vector="1">some.body(at)test.typo3.org</a>',
2560  ],
2561  'mono-alphabetic substitution offset +1 with at substitution' => [
2562  [
2563  'spamProtectEmailAddresses' => '1',
2564  'spamProtectEmailAddresses_atSubst' => '@',
2565  'spamProtectEmailAddresses_lastDotSubst' => '',
2566  ],
2567  'some.body@test.typo3.org',
2568  'mailto:some.body@test.typo3.org',
2569  '<a href="#" data-mailto-token="nbjmup+tpnf/cpezAuftu/uzqp4/psh" data-mailto-vector="1">some.body@test.typo3.org</a>',
2570  ],
2571  'mono-alphabetic substitution offset +1 with at and dot substitution' => [
2572  [
2573  'spamProtectEmailAddresses' => '1',
2574  'spamProtectEmailAddresses_atSubst' => '(at)',
2575  'spamProtectEmailAddresses_lastDotSubst' => '(dot)',
2576  ],
2577  'some.body@test.typo3.org',
2578  'mailto:some.body@test.typo3.org',
2579  '<a href="#" data-mailto-token="nbjmup+tpnf/cpezAuftu/uzqp4/psh" data-mailto-vector="1">some.body(at)test.typo3(dot)org</a>',
2580  ],
2581  'mono-alphabetic substitution offset -1 with at and dot substitution' => [
2582  [
2583  'spamProtectEmailAddresses' => '-1',
2584  'spamProtectEmailAddresses_atSubst' => '(at)',
2585  'spamProtectEmailAddresses_lastDotSubst' => '(dot)',
2586  ],
2587  'some.body@test.typo3.org',
2588  'mailto:some.body@test.typo3.org',
2589  '<a href="#" data-mailto-token="lzhksn9rnld-ancxZsdrs-sxon2-nqf" data-mailto-vector="-1">some.body(at)test.typo3(dot)org</a>',
2590  ],
2591  'mono-alphabetic substitution offset -1 with at and dot markup substitution' => [
2592  [
2593  'spamProtectEmailAddresses' => -1,
2594  'spamProtectEmailAddresses_atSubst' => '<span class="at"></span>',
2595  'spamProtectEmailAddresses_lastDotSubst' => '<span class="dot"></span>',
2596  ],
2597  'some.body@test.typo3.org',
2598  'mailto:some.body@test.typo3.org',
2599  '<a href="#" data-mailto-token="lzhksn9rnld-ancxZsdrs-sxon2-nqf" data-mailto-vector="-1">some.body<span class="at"></span>test.typo3<span class="dot"></span>org</a>',
2600  ],
2601  'mono-alphabetic substitution offset 2 with at and dot substitution and encoded subject' => [
2602  [
2603  'spamProtectEmailAddresses' => '2',
2604  'spamProtectEmailAddresses_atSubst' => '(at)',
2605  'spamProtectEmailAddresses_lastDotSubst' => '(dot)',
2606  ],
2607  'some.body@test.typo3.org',
2608  'mailto:some.body@test.typo3.org?subject=foo%20bar',
2609  // @todo no substitution, due to `?subject=` extension (which cannot be found in the link-text)
2610  '<a href="#" data-mailto-token="ocknvq,uqog0dqfaBvguv0varq50qti?uwdlgev=hqq%42dct" data-mailto-vector="2">some.body@test.typo3.org</a>',
2611  ],
2612  'entity substitution with at and dot substitution' => [
2613  [
2614  'spamProtectEmailAddresses' => 'ascii',
2615  'spamProtectEmailAddresses_atSubst' => '',
2616  'spamProtectEmailAddresses_lastDotSubst' => '',
2617  ],
2618  'some.body@test.typo3.org',
2619  'mailto:some.body@test.typo3.org',
2620  '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#111;&#109;&#101;&#46;&#98;&#111;&#100;&#121;&#64;&#116;&#101;&#115;&#116;&#46;&#116;&#121;&#112;&#111;&#51;&#46;&#111;&#114;&#103;">some.body(at)test.typo3.org</a>',
2621  ],
2622  'entity substitution with at and dot substitution with at and dot substitution' => [
2623  [
2624  'spamProtectEmailAddresses' => 'ascii',
2625  'spamProtectEmailAddresses_atSubst' => '(at)',
2626  'spamProtectEmailAddresses_lastDotSubst' => '(dot)',
2627  ],
2628  'some.body@test.typo3.org',
2629  'mailto:some.body@test.typo3.org',
2630  '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#111;&#109;&#101;&#46;&#98;&#111;&#100;&#121;&#64;&#116;&#101;&#115;&#116;&#46;&#116;&#121;&#112;&#111;&#51;&#46;&#111;&#114;&#103;">some.body(at)test.typo3(dot)org</a>',
2631  ],
2632  ];
2633  }
2634 
2638  public function ‪typolinkReturnsCorrectLinksFilesDataProvider(): array
2639  {
2640  return [
2641  'Link to file' => [
2642  'My file',
2643  [
2644  'directImageLink' => false,
2645  'parameter' => 'fileadmin/foo.bar',
2646  ],
2647  '<a href="fileadmin/foo.bar">My file</a>',
2648  ],
2649  'Link to file without link text' => [
2650  '',
2651  [
2652  'directImageLink' => false,
2653  'parameter' => 'fileadmin/foo.bar',
2654  ],
2655  '<a href="fileadmin/foo.bar">fileadmin/foo.bar</a>',
2656  ],
2657  'Link to file with attributes' => [
2658  'My file',
2659  [
2660  'parameter' => 'fileadmin/foo.bar',
2661  'ATagParams' => 'class="file-class"',
2662  'fileTarget' => '_blank',
2663  'title' => 'Title of the file',
2664  ],
2665  '<a href="fileadmin/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2666  ],
2667  'Link to file with attributes and additional href' => [
2668  'My file',
2669  [
2670  'parameter' => 'fileadmin/foo.bar',
2671  'ATagParams' => 'href="foo-bar"',
2672  'fileTarget' => '_blank',
2673  'title' => 'Title of the file',
2674  ],
2675  '<a href="fileadmin/foo.bar" title="Title of the file" target="_blank">My file</a>',
2676  ],
2677  'Link to file with attributes and additional href and class' => [
2678  'My file',
2679  [
2680  'parameter' => 'fileadmin/foo.bar',
2681  'ATagParams' => 'href="foo-bar" class="file-class"',
2682  'fileTarget' => '_blank',
2683  'title' => 'Title of the file',
2684  ],
2685  '<a href="fileadmin/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2686  ],
2687  'Link to file with attributes and additional class and href' => [
2688  'My file',
2689  [
2690  'parameter' => 'fileadmin/foo.bar',
2691  'ATagParams' => 'class="file-class" href="foo-bar"',
2692  'fileTarget' => '_blank',
2693  'title' => 'Title of the file',
2694  ],
2695  '<a href="fileadmin/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2696  ],
2697  'Link to file with attributes and additional class and href and title' => [
2698  'My file',
2699  [
2700  'parameter' => 'fileadmin/foo.bar',
2701  'ATagParams' => 'class="file-class" href="foo-bar" title="foo-bar"',
2702  'fileTarget' => '_blank',
2703  'title' => 'Title of the file',
2704  ],
2705  '<a href="fileadmin/foo.bar" title="foo-bar" target="_blank" class="file-class">My file</a>',
2706  ],
2707  'Link to file with attributes and empty ATagParams' => [
2708  'My file',
2709  [
2710  'parameter' => 'fileadmin/foo.bar',
2711  'ATagParams' => '',
2712  'fileTarget' => '_blank',
2713  'title' => 'Title of the file',
2714  ],
2715  '<a href="fileadmin/foo.bar" title="Title of the file" target="_blank">My file</a>',
2716  ],
2717  'Link to file with attributes in parameter' => [
2718  'My file',
2719  [
2720  'parameter' => 'fileadmin/foo.bar _blank file-class "Title of the file"',
2721  ],
2722  '<a href="fileadmin/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2723  ],
2724  'Link to file with script tag in name' => [
2725  '',
2726  [
2727  'directImageLink' => false,
2728  'parameter' => 'fileadmin/<script>alert(123)</script>',
2729  ],
2730  '<a href="fileadmin/&lt;script&gt;alert(123)&lt;/script&gt;">fileadmin/&lt;script&gt;alert(123)&lt;/script&gt;</a>',
2731  ],
2732  ];
2733  }
2734 
2742  public function ‪typolinkReturnsCorrectLinksFiles(string $linkText, array $configuration, string $expectedResult): void
2743  {
2744  $packageManagerMock = $this->getMockBuilder(PackageManager::class)
2745  ->disableOriginalConstructor()
2746  ->getMock();
2747  $templateServiceObjectMock = $this->getMockBuilder(TemplateService::class)
2748  ->setConstructorArgs([null, $packageManagerMock])
2749  ->addMethods(['dummy'])
2750  ->getMock();
2751  $templateServiceObjectMock->setup = [
2752  'lib.' => [
2753  'parseFunc.' => $this->‪getLibParseFunc(),
2754  ],
2755  ];
2756  $typoScriptFrontendControllerMockObject = $this->createMock(TypoScriptFrontendController::class);
2757  $typoScriptFrontendControllerMockObject->config = [
2758  'config' => [],
2759  ];
2760  $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock;
2761  ‪$GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject;
2762 
2763  $resourceFactory = $this->prophesize(ResourceFactory::class);
2764  GeneralUtility::setSingletonInstance(ResourceFactory::class, $resourceFactory->reveal());
2765 
2766  $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject);
2767 
2768  self::assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
2769  }
2770 
2775  {
2776  return [
2777  'Link to file' => [
2778  'My file',
2779  [
2780  'directImageLink' => false,
2781  'parameter' => 'fileadmin/foo.bar',
2782  ],
2783  '/',
2784  '<a href="/fileadmin/foo.bar">My file</a>',
2785  ],
2786  'Link to file with longer absRefPrefix' => [
2787  'My file',
2788  [
2789  'directImageLink' => false,
2790  'parameter' => 'fileadmin/foo.bar',
2791  ],
2792  '/sub/',
2793  '<a href="/sub/fileadmin/foo.bar">My file</a>',
2794  ],
2795  'Link to absolute file' => [
2796  'My file',
2797  [
2798  'directImageLink' => false,
2799  'parameter' => '/images/foo.bar',
2800  ],
2801  '/',
2802  '<a href="/images/foo.bar">My file</a>',
2803  ],
2804  'Link to absolute file with longer absRefPrefix' => [
2805  'My file',
2806  [
2807  'directImageLink' => false,
2808  'parameter' => '/images/foo.bar',
2809  ],
2810  '/sub/',
2811  '<a href="/images/foo.bar">My file</a>',
2812  ],
2813  'Link to absolute file with identical longer absRefPrefix' => [
2814  'My file',
2815  [
2816  'directImageLink' => false,
2817  'parameter' => '/sub/fileadmin/foo.bar',
2818  ],
2819  '/sub/',
2820  '<a href="/sub/fileadmin/foo.bar">My file</a>',
2821  ],
2822  'Link to file with empty absRefPrefix' => [
2823  'My file',
2824  [
2825  'directImageLink' => false,
2826  'parameter' => 'fileadmin/foo.bar',
2827  ],
2828  '',
2829  '<a href="fileadmin/foo.bar">My file</a>',
2830  ],
2831  'Link to absolute file with empty absRefPrefix' => [
2832  'My file',
2833  [
2834  'directImageLink' => false,
2835  'parameter' => '/fileadmin/foo.bar',
2836  ],
2837  '',
2838  '<a href="/fileadmin/foo.bar">My file</a>',
2839  ],
2840  'Link to file with attributes with absRefPrefix' => [
2841  'My file',
2842  [
2843  'parameter' => 'fileadmin/foo.bar',
2844  'ATagParams' => 'class="file-class"',
2845  'fileTarget' => '_blank',
2846  'title' => 'Title of the file',
2847  ],
2848  '/',
2849  '<a href="/fileadmin/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2850  ],
2851  'Link to file with attributes with longer absRefPrefix' => [
2852  'My file',
2853  [
2854  'parameter' => 'fileadmin/foo.bar',
2855  'ATagParams' => 'class="file-class"',
2856  'fileTarget' => '_blank',
2857  'title' => 'Title of the file',
2858  ],
2859  '/sub/',
2860  '<a href="/sub/fileadmin/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2861  ],
2862  'Link to absolute file with attributes with absRefPrefix' => [
2863  'My file',
2864  [
2865  'parameter' => '/images/foo.bar',
2866  'ATagParams' => 'class="file-class"',
2867  'fileTarget' => '_blank',
2868  'title' => 'Title of the file',
2869  ],
2870  '/',
2871  '<a href="/images/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2872  ],
2873  'Link to absolute file with attributes with longer absRefPrefix' => [
2874  'My file',
2875  [
2876  'parameter' => '/images/foo.bar',
2877  'ATagParams' => 'class="file-class"',
2878  'fileTarget' => '_blank',
2879  'title' => 'Title of the file',
2880  ],
2881  '/sub/',
2882  '<a href="/images/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2883  ],
2884  'Link to absolute file with attributes with identical longer absRefPrefix' => [
2885  'My file',
2886  [
2887  'parameter' => '/sub/fileadmin/foo.bar',
2888  'ATagParams' => 'class="file-class"',
2889  'fileTarget' => '_blank',
2890  'title' => 'Title of the file',
2891  ],
2892  '/sub/',
2893  '<a href="/sub/fileadmin/foo.bar" title="Title of the file" target="_blank" class="file-class">My file</a>',
2894  ],
2895  ];
2896  }
2897 
2907  string $linkText,
2908  array $configuration,
2909  string $absRefPrefix,
2910  string $expectedResult
2911  ): void {
2912  $packageManagerMock = $this->getMockBuilder(PackageManager::class)
2913  ->disableOriginalConstructor()
2914  ->getMock();
2915  $templateServiceObjectMock = $this->getMockBuilder(TemplateService::class)
2916  ->setConstructorArgs([null, $packageManagerMock])
2917  ->addMethods(['dummy'])
2918  ->getMock();
2919  $templateServiceObjectMock->setup = [
2920  'lib.' => [
2921  'parseFunc.' => $this->‪getLibParseFunc(),
2922  ],
2923  ];
2924  $resourceFactory = $this->prophesize(ResourceFactory::class);
2925  GeneralUtility::setSingletonInstance(ResourceFactory::class, $resourceFactory->reveal());
2926 
2927  $typoScriptFrontendControllerMockObject = $this->createMock(TypoScriptFrontendController::class);
2928  $typoScriptFrontendControllerMockObject->config = [
2929  'config' => [],
2930  ];
2931  $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock;
2932  ‪$GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject;
2933  ‪$GLOBALS['TSFE']->absRefPrefix = $absRefPrefix;
2934  $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject);
2935 
2936  self::assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
2937  }
2938 
2942  public function ‪typolinkOpensInNewWindow(): void
2943  {
2944  $this->cacheManager->getCache('runtime')->willReturn(new NullFrontend('runtime'));
2945  $this->cacheManager->getCache('core')->willReturn(new NullFrontend('runtime'));
2946  GeneralUtility::setSingletonInstance(
2947  SiteConfiguration::class,
2948  new SiteConfiguration(‪Environment::getConfigPath() . '/sites', new NullFrontend('dummy'))
2949  );
2950  $linkText = 'Nice Text';
2951  $configuration = [
2952  'parameter' => 'https://example.com 13x84:target=myexample',
2953  ];
2954  $expectedResult = '<a href="https://example.com" target="myexample" data-window-url="https://example.com" data-window-target="myexample" data-window-features="width=13,height=84" rel="noreferrer">Nice Text</a>';
2955  self::assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
2956  $linkText = 'Nice Text with default window name';
2957  $configuration = [
2958  'parameter' => 'https://example.com 13x84',
2959  ];
2960  $expectedResult = '<a href="https://example.com" target="FEopenLink" data-window-url="https://example.com" data-window-target="FEopenLink" data-window-features="width=13,height=84" rel="noreferrer">Nice Text with default window name</a>';
2961  self::assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
2962 
2963  $linkText = 'Nice Text with default window name';
2964  $configuration = [
2965  'parameter' => 'https://example.com 13x84',
2966  ];
2967  $expectedResult = '<a href="https://example.com" target="FEopenLink" data-window-url="https://example.com" data-window-target="FEopenLink" data-window-features="width=13,height=84" rel="noreferrer">Nice Text with default window name</a>';
2968  self::assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
2969 
2970  ‪$GLOBALS['TSFE']->xhtmlDoctype = 'xhtml_strict';
2971  $linkText = 'Nice Text with default window name';
2972  $configuration = [
2973  'parameter' => 'https://example.com 13x84',
2974  ];
2975  $expectedResult = '<a href="https://example.com" data-window-url="https://example.com" data-window-target="FEopenLink" data-window-features="width=13,height=84" rel="noreferrer">Nice Text with default window name</a>';
2976  self::assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
2977  }
2978 
2983  {
2984  $linkService = $this->prophesize(LinkService::class);
2985  GeneralUtility::setSingletonInstance(LinkService::class, $linkService->reveal());
2986  $linkService->resolve('foo')->willThrow(InvalidPathException::class);
2987 
2988  self::assertSame('foo', $this->subject->typoLink('foo', ['parameter' => 'foo']));
2989  }
2990 
2994  public function ‪typoLinkLogsErrorIfNoLinkResolvingIsPossible(): void
2995  {
2996  $linkService = $this->prophesize(LinkService::class);
2997  GeneralUtility::setSingletonInstance(LinkService::class, $linkService->reveal());
2998  $linkService->resolve('foo')->willThrow(InvalidPathException::class);
2999 
3000  $logger = $this->prophesize(Logger::class);
3001  $logger->warning('The link could not be generated', Argument::any())->shouldBeCalled();
3002  $this->subject->setLogger($logger->reveal());
3003  $this->subject->typoLink('foo', ['parameter' => 'foo']);
3004  }
3005 
3009  public function ‪typolinkLinkResult(): void
3010  {
3011  $packageManagerMock = $this->getMockBuilder(PackageManager::class)
3012  ->disableOriginalConstructor()
3013  ->getMock();
3014  $templateServiceObjectMock = $this->getMockBuilder(TemplateService::class)
3015  ->setConstructorArgs([null, $packageManagerMock])
3016  ->addMethods(['dummy'])
3017  ->getMock();
3018  $templateServiceObjectMock->setup = [
3019  'lib.' => [
3020  'parseFunc.' => $this->‪getLibParseFunc(),
3021  ],
3022  ];
3023  $typoScriptFrontendControllerMockObject = $this->createMock(TypoScriptFrontendController::class);
3024  $typoScriptFrontendControllerMockObject->config = [
3025  'config' => [],
3026  ];
3027  $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock;
3028  ‪$GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject;
3029 
3030  $resourceFactory = $this->prophesize(ResourceFactory::class);
3031  GeneralUtility::setSingletonInstance(ResourceFactory::class, $resourceFactory->reveal());
3032 
3033  $this->cacheManager->getCache('runtime')->willReturn(new NullFrontend('dummy'));
3034  $this->cacheManager->getCache('core')->willReturn(new NullFrontend('runtime'));
3035 
3036  GeneralUtility::setSingletonInstance(
3037  SiteConfiguration::class,
3038  new SiteConfiguration(‪Environment::getConfigPath() . '/sites', new NullFrontend('dummy'))
3039  );
3040 
3041  $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject);
3042 
3043  $linkResult = $this->subject->typoLink('', [
3044  'parameter' => 'https://example.tld',
3045  'returnLast' => 'result', ]);
3046 
3047  self::assertTrue(is_a($linkResult, LinkResultInterface::class, true));
3048  self::assertEquals(json_encode([
3049  'href' => 'https://example.tld',
3050  'target' => null,
3051  'class' => null,
3052  'title' => null,
3053  'linkText' => 'https://example.tld',
3054  'additionalAttributes' => [], ]), json_encode($linkResult));
3055  self::assertEquals(json_encode([
3056  'href' => 'https://example.tld',
3057  'target' => null,
3058  'class' => null,
3059  'title' => null,
3060  'linkText' => 'https://example.tld',
3061  'additionalAttributes' => [], ]), (string)$linkResult);
3062  }
3063 
3068  public function ‪typoLinkProperlyEncodesLinkResult(string $linkText, array $configuration, string $expectedResult): void
3069  {
3070  $packageManagerMock = $this->getMockBuilder(PackageManager::class)
3071  ->disableOriginalConstructor()
3072  ->getMock();
3073  $templateServiceObjectMock = $this->getMockBuilder(TemplateService::class)
3074  ->setConstructorArgs([null, $packageManagerMock])
3075  ->addMethods(['dummy'])
3076  ->getMock();
3077  $templateServiceObjectMock->setup = [
3078  'lib.' => [
3079  'parseFunc.' => $this->‪getLibParseFunc(),
3080  ],
3081  ];
3082  $typoScriptFrontendControllerMockObject = $this->createMock(TypoScriptFrontendController::class);
3083  $typoScriptFrontendControllerMockObject->config = [
3084  'config' => [],
3085  ];
3086  $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock;
3087  ‪$GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject;
3088 
3089  $resourceFactory = $this->prophesize(ResourceFactory::class);
3090  GeneralUtility::setSingletonInstance(ResourceFactory::class, $resourceFactory->reveal());
3091 
3092  $this->cacheManager->getCache('runtime')->willReturn(new NullFrontend('dummy'));
3093  $this->cacheManager->getCache('core')->willReturn(new NullFrontend('runtime'));
3094 
3095  GeneralUtility::setSingletonInstance(
3096  SiteConfiguration::class,
3097  new SiteConfiguration(‪Environment::getConfigPath() . '/sites', new NullFrontend('dummy'))
3098  );
3099 
3100  $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject);
3101 
3102  self::assertEquals($expectedResult, (string)$this->subject->typoLink($linkText, $configuration));
3103  }
3104 
3108  public function ‪typoLinkProperlyEncodesLinkResultDataProvider(): array
3109  {
3110  return [
3111  'Link to file' => [
3112  'My file',
3113  [
3114  'directImageLink' => false,
3115  'parameter' => '/fileadmin/foo.bar',
3116  'returnLast' => 'result',
3117  ],
3118  json_encode([
3119  'href' => '/fileadmin/foo.bar',
3120  'target' => null,
3121  'class' => null,
3122  'title' => null,
3123  'linkText' => 'My file',
3124  'additionalAttributes' => [],
3125  ]),
3126  ],
3127  'Link example' => [
3128  'My example',
3129  [
3130  'directImageLink' => false,
3131  'parameter' => 'https://example.tld',
3132  'returnLast' => 'result',
3133  ],
3134  json_encode([
3135  'href' => 'https://example.tld',
3136  'target' => null,
3137  'class' => null,
3138  'title' => null,
3139  'linkText' => 'My example',
3140  'additionalAttributes' => [],
3141  ]),
3142  ],
3143  'Link to file with attributes' => [
3144  'My file',
3145  [
3146  'parameter' => '/fileadmin/foo.bar',
3147  'fileTarget' => '_blank',
3148  'returnLast' => 'result',
3149  ],
3150  json_encode([
3151  'href' => '/fileadmin/foo.bar',
3152  'target' => '_blank',
3153  'class' => null,
3154  'title' => null,
3155  'linkText' => 'My file',
3156  'additionalAttributes' => [],
3157  ]),
3158  ],
3159  'Link parsing' => [
3160  'Url',
3161  [
3162  'parameter' => 'https://example.com _blank css-class "test title"',
3163  'returnLast' => 'result',
3164  ],
3165  json_encode([
3166  'href' => 'https://example.com',
3167  'target' => '_blank',
3168  'class' => 'css-class',
3169  'title' => 'test title',
3170  'linkText' => 'Url',
3171  'additionalAttributes' => ['rel' => 'noreferrer'],
3172  ]),
3173  ],
3174  ];
3175  }
3176 
3180  public function ‪stdWrap_splitObjReturnsCount(): void
3181  {
3182  $conf = [
3183  'token' => ',',
3184  'returnCount' => 1,
3185  ];
3186  $expectedResult = 5;
3187  $amountOfEntries = $this->subject->splitObj('1, 2, 3, 4, 5', $conf);
3188  self::assertSame(
3189  $expectedResult,
3190  $amountOfEntries
3191  );
3192  }
3193 
3199  public function ‪calculateCacheKeyDataProvider(): array
3200  {
3201  $value = ‪StringUtility::getUniqueId('value');
3202  $wrap = [‪StringUtility::getUniqueId('wrap')];
3203  $valueConf = ['key' => $value];
3204  $wrapConf = ['key.' => $wrap];
3205  $conf = array_merge($valueConf, $wrapConf);
3206  $will = ‪StringUtility::getUniqueId('stdWrap');
3207 
3208  return [
3209  'no conf' => [
3210  '',
3211  [],
3212  0,
3213  null,
3214  null,
3215  null,
3216  ],
3217  'value conf only' => [
3218  $value,
3219  $valueConf,
3220  0,
3221  null,
3222  null,
3223  null,
3224  ],
3225  'wrap conf only' => [
3226  $will,
3227  $wrapConf,
3228  1,
3229  '',
3230  $wrap,
3231  $will,
3232  ],
3233  'full conf' => [
3234  $will,
3235  $conf,
3236  1,
3237  $value,
3238  $wrap,
3239  $will,
3240  ],
3241  ];
3242  }
3243 
3259  public function ‪calculateCacheKey(string $expect, array $conf, int $times, ?string $with, ?array $withWrap, ?string $will): void
3260  {
3261  ‪$subject = $this->getAccessibleMock(ContentObjectRenderer::class, ['stdWrap']);
3262  ‪$subject->expects(self::exactly($times))
3263  ->method('stdWrap')
3264  ->with($with, $withWrap)
3265  ->willReturn($will);
3266 
3267  $result = ‪$subject->_call('calculateCacheKey', $conf);
3268  self::assertSame($expect, $result);
3269  }
3270 
3276  public function ‪getFromCacheDataProvider(): array
3277  {
3278  $conf = [‪StringUtility::getUniqueId('conf')];
3279  return [
3280  'empty cache key' => [
3281  false,
3282  $conf,
3283  '',
3284  0,
3285  null,
3286  ],
3287  'non-empty cache key' => [
3288  'value',
3289  $conf,
3290  'non-empty-key',
3291  1,
3292  'value',
3293  ],
3294  ];
3295  }
3296 
3313  public function ‪getFromCache($expect, array $conf, string $cacheKey, int $times, ?string $cached): void
3314  {
3315  ‪$subject = $this->getAccessibleMock(
3316  ContentObjectRenderer::class,
3317  ['calculateCacheKey']
3318  );
3319  ‪$subject
3320  ->expects(self::once())
3321  ->method('calculateCacheKey')
3322  ->with($conf)
3323  ->willReturn($cacheKey);
3324  $cacheFrontend = $this->createMock(CacheFrontendInterface::class);
3325  $cacheFrontend
3326  ->expects(self::exactly($times))
3327  ->method('get')
3328  ->with($cacheKey)
3329  ->willReturn($cached);
3330  ‪$cacheManager = $this->createMock(CacheManager::class);
3332  ->method('getCache')
3333  ->willReturn($cacheFrontend);
3334  GeneralUtility::setSingletonInstance(
3335  CacheManager::class,
3337  );
3338  self::assertSame($expect, ‪$subject->_call('getFromCache', $conf));
3339  }
3340 
3346  public function ‪getFieldValDataProvider(): array
3347  {
3348  return [
3349  'invalid single key' => [null, 'invalid'],
3350  'single key of null' => [null, 'null'],
3351  'single key of empty string' => ['', 'empty'],
3352  'single key of non-empty string' => ['string 1', 'string1'],
3353  'single key of boolean false' => [false, 'false'],
3354  'single key of boolean true' => [true, 'true'],
3355  'single key of integer 0' => [0, 'zero'],
3356  'single key of integer 1' => [1, 'one'],
3357  'single key to be trimmed' => ['string 1', ' string1 '],
3358 
3359  'split nothing' => ['', '//'],
3360  'split one before' => ['string 1', 'string1//'],
3361  'split one after' => ['string 1', '//string1'],
3362  'split two ' => ['string 1', 'string1//string2'],
3363  'split three ' => ['string 1', 'string1//string2//string3'],
3364  'split to be trimmed' => ['string 1', ' string1 // string2 '],
3365  '0 is not empty' => [0, '// zero'],
3366  '1 is not empty' => [1, '// one'],
3367  'true is not empty' => [true, '// true'],
3368  'false is empty' => ['', '// false'],
3369  'null is empty' => ['', '// null'],
3370  'empty string is empty' => ['', '// empty'],
3371  'string is not empty' => ['string 1', '// string1'],
3372  'first non-empty winns' => [0, 'false//empty//null//zero//one'],
3373  'empty string is fallback' => ['', 'false // empty // null'],
3374  ];
3375  }
3376 
3415  public function ‪getFieldVal($expect, string ‪$fields): void
3416  {
3417  $data = [
3418  'string1' => 'string 1',
3419  'string2' => 'string 2',
3420  'string3' => 'string 3',
3421  'empty' => '',
3422  'null' => null,
3423  'false' => false,
3424  'true' => true,
3425  'zero' => 0,
3426  'one' => 1,
3427  ];
3428  $this->subject->_set('data', $data);
3429  self::assertSame($expect, $this->subject->getFieldVal(‪$fields));
3430  }
3431 
3437  public function ‪caseshiftDataProvider(): array
3438  {
3439  return [
3440  'lower' => ['x y', 'X Y', 'lower'],
3441  'upper' => ['X Y', 'x y', 'upper'],
3442  'capitalize' => ['One Two', 'one two', 'capitalize'],
3443  'ucfirst' => ['One two', 'one two', 'ucfirst'],
3444  'lcfirst' => ['oNE TWO', 'ONE TWO', 'lcfirst'],
3445  'uppercamelcase' => ['CamelCase', 'camel_case', 'uppercamelcase'],
3446  'lowercamelcase' => ['camelCase', 'camel_case', 'lowercamelcase'],
3447  ];
3448  }
3449 
3459  public function ‪caseshift(string $expect, string $content, string $case): void
3460  {
3461  self::assertSame(
3462  $expect,
3463  $this->subject->caseshift($content, $case)
3464  );
3465  }
3466 
3472  public function ‪HTMLcaseshiftDataProvider(): array
3473  {
3474  $case = ‪StringUtility::getUniqueId('case');
3475  return [
3476  'simple text' => [
3477  'TEXT',
3478  'text',
3479  $case,
3480  [['text', $case]],
3481  ['TEXT'],
3482  ],
3483  'simple tag' => [
3484  '<i>TEXT</i>',
3485  '<i>text</i>',
3486  $case,
3487  [['', $case], ['text', $case]],
3488  ['', 'TEXT'],
3489  ],
3490  'multiple nested tags with classes' => [
3491  '<div class="typo3">'
3492  . '<p>A <b>BOLD<\b> WORD.</p>'
3493  . '<p>AN <i>ITALIC<\i> WORD.</p>'
3494  . '</div>',
3495  '<div class="typo3">'
3496  . '<p>A <b>bold<\b> word.</p>'
3497  . '<p>An <i>italic<\i> word.</p>'
3498  . '</div>',
3499  $case,
3500  [
3501  ['', $case],
3502  ['', $case],
3503  ['A ', $case],
3504  ['bold', $case],
3505  [' word.', $case],
3506  ['', $case],
3507  ['An ', $case],
3508  ['italic', $case],
3509  [' word.', $case],
3510  ['', $case],
3511  ],
3512  ['', '', 'A ', 'BOLD', ' WORD.', '', 'AN ', 'ITALIC', ' WORD.', ''],
3513  ],
3514  ];
3515  }
3516 
3533  public function ‪HTMLcaseshift(string $expect, string $content, string $case, array $with, array $will): void
3534  {
3535  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
3536  ->onlyMethods(['caseshift'])->getMock();
3537  ‪$subject
3538  ->expects(self::exactly(count($with)))
3539  ->method('caseshift')
3540  ->withConsecutive(...$with)
3541  ->will(self::onConsecutiveCalls(...$will));
3542  self::assertSame(
3543  $expect,
3544  ‪$subject->HTMLcaseshift($content, $case)
3545  );
3546  }
3547 
3548  /***************************************************************************
3549  * General tests for stdWrap_
3550  ***************************************************************************/
3551 
3563  public function ‪allStdWrapProcessorsAreCallable(): void
3564  {
3565  $callable = 0;
3566  $notCallable = 0;
3567  $processors = ['invalidProcessor'];
3568  foreach (array_keys($this->subject->_get('stdWrapOrder')) as $key) {
3569  $processors[] = strtr($key, ['.' => '']);
3570  }
3571  foreach (array_unique($processors) as $processor) {
3572  $method = [‪$this->subject, 'stdWrap_' . $processor];
3573  if (is_callable($method)) {
3574  ++$callable;
3575  } else {
3576  ++$notCallable;
3577  }
3578  }
3579  self::assertSame(1, $notCallable);
3580  self::assertSame(83, $callable);
3581  }
3582 
3603  {
3604  $timeTrackerProphecy = $this->prophesize(TimeTracker::class);
3605  GeneralUtility::setSingletonInstance(TimeTracker::class, $timeTrackerProphecy->reveal());
3606 
3607  // `parseFunc` issues deprecation in case `htmlSanitize` is not given
3608  $expectExceptions = ['numRows', 'parseFunc'];
3609  $count = 0;
3610  $processors = [];
3611  $exceptions = [];
3612  foreach (array_keys($this->subject->_get('stdWrapOrder')) as $key) {
3613  $processors[] = strtr($key, ['.' => '']);
3614  }
3615  foreach (array_unique($processors) as $processor) {
3616  ++$count;
3617  try {
3618  $conf = [$processor => '', $processor . '.' => ['table' => 'tt_content']];
3619  $method = 'stdWrap_' . $processor;
3620  $this->subject->$method('', $conf);
3621  } catch (\Exception $e) {
3622  $exceptions[] = $processor;
3623  }
3624  }
3625  self::assertSame($expectExceptions, $exceptions);
3626  self::assertSame(83, $count);
3627  }
3628 
3629  /***************************************************************************
3630  * End general tests for stdWrap_
3631  ***************************************************************************/
3632 
3633  /***************************************************************************
3634  * Tests for stdWrap_ in alphabetical order (all uppercase before lowercase)
3635  ***************************************************************************/
3636 
3643  {
3644  return [
3645  'preProcess' => [
3646  'stdWrap_stdWrapPreProcess',
3647  'stdWrapPreProcess',
3648  ],
3649  'override' => [
3650  'stdWrap_stdWrapOverride',
3651  'stdWrapOverride',
3652  ],
3653  'process' => [
3654  'stdWrap_stdWrapProcess',
3655  'stdWrapProcess',
3656  ],
3657  'postProcess' => [
3658  'stdWrap_stdWrapPostProcess',
3659  'stdWrapPostProcess',
3660  ],
3661  ];
3662  }
3663 
3680  string $stdWrapMethod,
3681  string $hookObjectCall
3682  ): void {
3683  $conf = [‪StringUtility::getUniqueId('conf')];
3684  $content = ‪StringUtility::getUniqueId('content');
3685  $processed1 = ‪StringUtility::getUniqueId('processed1');
3686  $processed2 = ‪StringUtility::getUniqueId('processed2');
3687  $hookObject1 = $this->createMock(
3688  ContentObjectStdWrapHookInterface::class
3689  );
3690  $hookObject1->expects(self::once())
3691  ->method($hookObjectCall)
3692  ->with($content, $conf)
3693  ->willReturn($processed1);
3694  $hookObject2 = $this->createMock(
3695  ContentObjectStdWrapHookInterface::class
3696  );
3697  $hookObject2->expects(self::once())
3698  ->method($hookObjectCall)
3699  ->with($processed1, $conf)
3700  ->willReturn($processed2);
3701  $this->subject->_set(
3702  'stdWrapHookObjects',
3703  [$hookObject1, $hookObject2]
3704  );
3705  $result = $this->subject->$stdWrapMethod($content, $conf);
3706  self::assertSame($processed2, $result);
3707  }
3708 
3714  public function ‪stdWrap_HTMLparserDataProvider(): array
3715  {
3716  $content = ‪StringUtility::getUniqueId('content');
3717  $parsed = ‪StringUtility::getUniqueId('parsed');
3718  return [
3719  'no config' => [
3720  $content,
3721  $content,
3722  [],
3723  0,
3724  $parsed,
3725  ],
3726  'no array' => [
3727  $content,
3728  $content,
3729  ['HTMLparser.' => 1],
3730  0,
3731  $parsed,
3732  ],
3733  'empty array' => [
3734  $parsed,
3735  $content,
3736  ['HTMLparser.' => []],
3737  1,
3738  $parsed,
3739  ],
3740  'non-empty array' => [
3741  $parsed,
3742  $content,
3743  ['HTMLparser.' => [true]],
3744  1,
3745  $parsed,
3746  ],
3747  ];
3748  }
3749 
3772  public function ‪stdWrap_HTMLparser(
3773  string $expect,
3774  string $content,
3775  array $conf,
3776  int $times,
3777  string $will
3778  ): void {
3779  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
3780  ->onlyMethods(['HTMLparser_TSbridge'])->getMock();
3781  ‪$subject
3782  ->expects(self::exactly($times))
3783  ->method('HTMLparser_TSbridge')
3784  ->with($content, $conf['HTMLparser.'] ?? [])
3785  ->willReturn($will);
3786  self::assertSame(
3787  $expect,
3788  ‪$subject->stdWrap_HTMLparser($content, $conf)
3789  );
3790  }
3791 
3796  {
3797  return [
3798  'No Tag' => [
3799  [],
3800  ['addPageCacheTags' => ''],
3801  ],
3802  'Two expectedTags' => [
3803  ['tag1', 'tag2'],
3804  ['addPageCacheTags' => 'tag1,tag2'],
3805  ],
3806  'Two expectedTags plus one with stdWrap' => [
3807  ['tag1', 'tag2', 'tag3'],
3808  [
3809  'addPageCacheTags' => 'tag1,tag2',
3810  'addPageCacheTags.' => ['wrap' => '|,tag3'],
3811  ],
3812  ],
3813  ];
3814  }
3815 
3822  public function ‪stdWrap_addPageCacheTagsAddsPageTags(array $expectedTags, array $configuration): void
3823  {
3824  $this->subject->stdWrap_addPageCacheTags('', $configuration);
3825  self::assertEquals($expectedTags, $this->frontendControllerMock->_get('pageCacheTags'));
3826  }
3827 
3840  public function ‪stdWrap_age(): void
3841  {
3842  $now = 10;
3843  $content = '9';
3844  $conf = ['age' => ‪StringUtility::getUniqueId('age')];
3845  $return = ‪StringUtility::getUniqueId('return');
3846  $difference = $now - (int)$content;
3847  ‪$GLOBALS['EXEC_TIME'] = $now;
3848  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
3849  ->onlyMethods(['calcAge'])->getMock();
3850  ‪$subject
3851  ->expects(self::once())
3852  ->method('calcAge')
3853  ->with($difference, $conf['age'])
3854  ->willReturn($return);
3855  self::assertSame($return, ‪$subject->stdWrap_age($content, $conf));
3856  }
3857 
3871  public function ‪stdWrap_append(): void
3872  {
3873  $debugKey = '/stdWrap/.append';
3874  $content = ‪StringUtility::getUniqueId('content');
3875  $conf = [
3876  'append' => ‪StringUtility::getUniqueId('append'),
3877  'append.' => [‪StringUtility::getUniqueId('append.')],
3878  ];
3879  $return = ‪StringUtility::getUniqueId('return');
3880  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
3881  ->onlyMethods(['cObjGetSingle'])->getMock();
3882  ‪$subject
3883  ->expects(self::once())
3884  ->method('cObjGetSingle')
3885  ->with($conf['append'], $conf['append.'], $debugKey)
3886  ->willReturn($return);
3887  self::assertSame(
3888  $content . $return,
3889  ‪$subject->stdWrap_append($content, $conf)
3890  );
3891  }
3892 
3898  public function ‪stdWrapBrDataProvider(): array
3899  {
3900  return [
3901  'no xhtml with LF in between' => [
3902  'one<br>' . LF . 'two',
3903  'one' . LF . 'two',
3904  null,
3905  ],
3906  'no xhtml with LF in between and around' => [
3907  '<br>' . LF . 'one<br>' . LF . 'two<br>' . LF,
3908  LF . 'one' . LF . 'two' . LF,
3909  null,
3910  ],
3911  'xhtml with LF in between' => [
3912  'one<br />' . LF . 'two',
3913  'one' . LF . 'two',
3914  'xhtml_strict',
3915  ],
3916  'xhtml with LF in between and around' => [
3917  '<br />' . LF . 'one<br />' . LF . 'two<br />' . LF,
3918  LF . 'one' . LF . 'two' . LF,
3919  'xhtml_strict',
3920  ],
3921  ];
3922  }
3923 
3933  public function ‪stdWrap_br(string $expected, string $input, ?string $xhtmlDoctype): void
3934  {
3935  ‪$GLOBALS['TSFE']->xhtmlDoctype = $xhtmlDoctype;
3936  self::assertSame($expected, $this->subject->stdWrap_br($input));
3937  }
3938 
3944  public function ‪stdWrapBrTagDataProvider(): array
3945  {
3946  $noConfig = [];
3947  $config1 = ['brTag' => '<br/>'];
3948  $config2 = ['brTag' => '<br>'];
3949  return [
3950  'no config: one break at the beginning' => [LF . 'one' . LF . 'two', 'onetwo', $noConfig],
3951  'no config: multiple breaks at the beginning' => [LF . LF . 'one' . LF . 'two', 'onetwo', $noConfig],
3952  'no config: one break at the end' => ['one' . LF . 'two' . LF, 'onetwo', $noConfig],
3953  'no config: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'onetwo', $noConfig],
3954 
3955  'config1: one break at the beginning' => [LF . 'one' . LF . 'two', '<br/>one<br/>two', $config1],
3956  'config1: multiple breaks at the beginning' => [
3957  LF . LF . 'one' . LF . 'two',
3958  '<br/><br/>one<br/>two',
3959  $config1,
3960  ],
3961  'config1: one break at the end' => ['one' . LF . 'two' . LF, 'one<br/>two<br/>', $config1],
3962  'config1: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'one<br/>two<br/><br/>', $config1],
3963 
3964  'config2: one break at the beginning' => [LF . 'one' . LF . 'two', '<br>one<br>two', $config2],
3965  'config2: multiple breaks at the beginning' => [
3966  LF . LF . 'one' . LF . 'two',
3967  '<br><br>one<br>two',
3968  $config2,
3969  ],
3970  'config2: one break at the end' => ['one' . LF . 'two' . LF, 'one<br>two<br>', $config2],
3971  'config2: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'one<br>two<br><br>', $config2],
3972  ];
3973  }
3974 
3984  public function ‪stdWrap_brTag(string $input, string $expected, array $config): void
3985  {
3986  self::assertEquals($expected, $this->subject->stdWrap_brTag($input, $config));
3987  }
3988 
3994  public function ‪stdWrap_bytesDataProvider(): array
3995  {
3996  return [
3997  'value 1234 default' => [
3998  '1.21 Ki',
3999  '1234',
4000  ['labels' => '', 'base' => 0],
4001  ],
4002  'value 1234 si' => [
4003  '1.23 k',
4004  '1234',
4005  ['labels' => 'si', 'base' => 0],
4006  ],
4007  'value 1234 iec' => [
4008  '1.21 Ki',
4009  '1234',
4010  ['labels' => 'iec', 'base' => 0],
4011  ],
4012  'value 1234 a-i' => [
4013  '1.23b',
4014  '1234',
4015  ['labels' => 'a|b|c|d|e|f|g|h|i', 'base' => 1000],
4016  ],
4017  'value 1234 a-i invalid base' => [
4018  '1.21b',
4019  '1234',
4020  ['labels' => 'a|b|c|d|e|f|g|h|i', 'base' => 54],
4021  ],
4022  'value 1234567890 default' => [
4023  '1.15 Gi',
4024  '1234567890',
4025  ['labels' => '', 'base' => 0],
4026  ],
4027  'value 1234 iec no base' => [
4028  '1.21 Ki',
4029  '1234',
4030  ['labels' => 'iec'],
4031  ],
4032  'value 1234 no labels base set' => [
4033  '1.21 Ki',
4034  '1234',
4035  ['base' => 0],
4036  ],
4037  ];
4038  }
4039 
4061  public function ‪stdWrap_bytes(string $expect, string $content, array $conf): void
4062  {
4063  $locale = 'en_US.UTF-8';
4064  try {
4065  $this->setLocale(LC_NUMERIC, $locale);
4066  } catch (Exception $e) {
4067  self::markTestSkipped('Locale ' . $locale . ' is not available.');
4068  }
4069  $conf = ['bytes.' => $conf];
4070  self::assertSame(
4071  $expect,
4072  $this->subject->stdWrap_bytes($content, $conf)
4073  );
4074  }
4075 
4089  public function ‪stdWrap_cObject(): void
4090  {
4091  $debugKey = '/stdWrap/.cObject';
4092  $content = ‪StringUtility::getUniqueId('content');
4093  $conf = [
4094  'cObject' => ‪StringUtility::getUniqueId('cObject'),
4095  'cObject.' => [‪StringUtility::getUniqueId('cObject.')],
4096  ];
4097  $return = ‪StringUtility::getUniqueId('return');
4098  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
4099  ->onlyMethods(['cObjGetSingle'])->getMock();
4100  ‪$subject
4101  ->expects(self::once())
4102  ->method('cObjGetSingle')
4103  ->with($conf['cObject'], $conf['cObject.'], $debugKey)
4104  ->willReturn($return);
4105  self::assertSame(
4106  $return,
4107  ‪$subject->stdWrap_cObject($content, $conf)
4108  );
4109  }
4110 
4116  public function ‪stdWrap_orderedStdWrapDataProvider(): array
4117  {
4118  $confA = [‪StringUtility::getUniqueId('conf A')];
4119  $confB = [‪StringUtility::getUniqueId('conf B')];
4120  return [
4121  'standard case: order 1, 2' => [
4122  $confA,
4123  $confB,
4124  ['1.' => $confA, '2.' => $confB],
4125  ],
4126  'inverted: order 2, 1' => [
4127  $confB,
4128  $confA,
4129  ['2.' => $confA, '1.' => $confB],
4130  ],
4131  '0 as integer: order 0, 2' => [
4132  $confA,
4133  $confB,
4134  ['0.' => $confA, '2.' => $confB],
4135  ],
4136  'negative integers: order 2, -2' => [
4137  $confB,
4138  $confA,
4139  ['2.' => $confA, '-2.' => $confB],
4140  ],
4141  'chars are casted to key 0, that is not in the array' => [
4142  null,
4143  $confB,
4144  ['2.' => $confB, 'xxx.' => $confA],
4145  ],
4146  ];
4147  }
4148 
4171  public function ‪stdWrap_orderedStdWrap(?array $firstConf, array $secondConf, array $conf): void
4172  {
4173  $content = ‪StringUtility::getUniqueId('content');
4174  $between = ‪StringUtility::getUniqueId('between');
4175  $expect = ‪StringUtility::getUniqueId('expect');
4176  $conf['orderedStdWrap.'] = $conf;
4177  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
4178  ->onlyMethods(['stdWrap'])->getMock();
4179  ‪$subject
4180  ->expects(self::exactly(2))
4181  ->method('stdWrap')
4182  ->withConsecutive([$content, $firstConf], [$between, $secondConf])
4183  ->will(self::onConsecutiveCalls($between, $expect));
4184  self::assertSame(
4185  $expect,
4186  ‪$subject->stdWrap_orderedStdWrap($content, $conf)
4187  );
4188  }
4189 
4195  public function ‪stdWrap_cacheReadDataProvider(): array
4196  {
4197  $cacheConf = [‪StringUtility::getUniqueId('cache.')];
4198  $conf = ['cache.' => $cacheConf];
4199  return [
4200  'no conf' => [
4201  'content',
4202  'content',
4203  [],
4204  0,
4205  null,
4206  null,
4207  ],
4208  'no cache. conf' => [
4209  'content',
4210  'content',
4211  ['otherConf' => 1],
4212  0,
4213  null,
4214  null,
4215  ],
4216  'non-cached simulation' => [
4217  'content',
4218  'content',
4219  $conf,
4220  1,
4221  $cacheConf,
4222  false,
4223  ],
4224  'cached simulation' => [
4225  'cachedContent',
4226  'content',
4227  $conf,
4228  1,
4229  $cacheConf,
4230  'cachedContent',
4231  ],
4232  ];
4233  }
4234 
4251  public function ‪stdWrap_cacheRead(
4252  string $expect,
4253  string $input,
4254  array $conf,
4255  int $times,
4256  ?array $with,
4257  $will
4258  ): void {
4259  ‪$subject = $this->getAccessibleMock(
4260  ContentObjectRenderer::class,
4261  ['getFromCache']
4262  );
4263  ‪$subject
4264  ->expects(self::exactly($times))
4265  ->method('getFromCache')
4266  ->with($with)
4267  ->willReturn($will);
4268  self::assertSame(
4269  $expect,
4270  ‪$subject->stdWrap_cacheRead($input, $conf)
4271  );
4272  }
4273 
4279  public function ‪stdWrap_cacheStoreDataProvider(): array
4280  {
4281  $confCache = [‪StringUtility::getUniqueId('cache.')];
4282  $key = [‪StringUtility::getUniqueId('key')];
4283  return [
4284  'Return immediate with no conf' => [
4285  null,
4286  0,
4287  null,
4288  0,
4289  ],
4290  'Return immediate with empty key' => [
4291  $confCache,
4292  1,
4293  '0',
4294  0,
4295  ],
4296  'Call all methods' => [
4297  $confCache,
4298  1,
4299  $key,
4300  1,
4301  ],
4302  ];
4303  }
4304 
4326  public function ‪stdWrap_cacheStore(
4327  ?array $confCache,
4328  int $timesCCK,
4329  $key,
4330  int $times
4331  ): void {
4332  $content = ‪StringUtility::getUniqueId('content');
4333  $conf = [];
4334  $conf['cache.'] = $confCache;
4335  $tags = [‪StringUtility::getUniqueId('tags')];
4336  $lifetime = ‪StringUtility::getUniqueId('lifetime');
4337  $params = [
4338  'key' => $key,
4339  'content' => $content,
4340  'lifetime' => $lifetime,
4341  'tags' => $tags,
4342  ];
4343  ‪$subject = $this->getAccessibleMock(
4344  ContentObjectRenderer::class,
4345  [
4346  'calculateCacheKey',
4347  'calculateCacheTags',
4348  'calculateCacheLifetime',
4349  ]
4350  );
4351  ‪$subject
4352  ->expects(self::exactly($timesCCK))
4353  ->method('calculateCacheKey')
4354  ->with($confCache)
4355  ->willReturn($key);
4356  ‪$subject
4357  ->expects(self::exactly($times))
4358  ->method('calculateCacheTags')
4359  ->with($confCache)
4360  ->willReturn($tags);
4361  ‪$subject
4362  ->expects(self::exactly($times))
4363  ->method('calculateCacheLifetime')
4364  ->with($confCache)
4365  ->willReturn($lifetime);
4366  $cacheFrontend = $this->createMock(CacheFrontendInterface::class);
4367  $cacheFrontend
4368  ->expects(self::exactly($times))
4369  ->method('set')
4370  ->with($key, $content, $tags, $lifetime)
4371  ->willReturn(null);
4372  ‪$cacheManager = $this->createMock(CacheManager::class);
4374  ->method('getCache')
4375  ->willReturn($cacheFrontend);
4376  GeneralUtility::setSingletonInstance(
4377  CacheManager::class,
4379  );
4380  [$countCalls, $test] = [0, $this];
4381  $closure = static function ($par1, $par2) use (
4382  $test,
4383  ‪$subject,
4384  $params,
4385  &$countCalls
4386  ) {
4387  $test->assertSame($params, $par1);
4388  $test->assertSame(‪$subject, $par2);
4389  $countCalls++;
4390  };
4391  ‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap_cacheStore'] = [
4392  $closure,
4393  $closure,
4394  $closure,
4395  ];
4396  self::assertSame(
4397  $content,
4398  ‪$subject->stdWrap_cacheStore($content, $conf)
4399  );
4400  self::assertSame($times * 3, $countCalls);
4401  }
4402 
4415  public function ‪stdWrap_case(): void
4416  {
4417  $content = ‪StringUtility::getUniqueId();
4418  $conf = [
4419  'case' => ‪StringUtility::getUniqueId('used'),
4420  'case.' => [‪StringUtility::getUniqueId('discarded')],
4421  ];
4422  $return = ‪StringUtility::getUniqueId();
4423  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
4424  ->onlyMethods(['HTMLcaseshift'])->getMock();
4425  ‪$subject
4426  ->expects(self::once())
4427  ->method('HTMLcaseshift')
4428  ->with($content, $conf['case'])
4429  ->willReturn($return);
4430  self::assertSame(
4431  $return,
4432  ‪$subject->stdWrap_case($content, $conf)
4433  );
4434  }
4435 
4441  public function ‪stdWrap_char(): void
4442  {
4443  $input = 'discarded';
4444  $expected = 'C';
4445  self::assertEquals($expected, $this->subject->stdWrap_char($input, ['char' => '67']));
4446  }
4447 
4460  public function ‪stdWrap_crop(): void
4461  {
4462  $content = ‪StringUtility::getUniqueId('content');
4463  $conf = [
4464  'crop' => ‪StringUtility::getUniqueId('crop'),
4465  'crop.' => ‪StringUtility::getUniqueId('not used'),
4466  ];
4467  $return = ‪StringUtility::getUniqueId('return');
4468  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
4469  ->onlyMethods(['crop'])->getMock();
4470  ‪$subject
4471  ->expects(self::once())
4472  ->method('crop')
4473  ->with($content, $conf['crop'])
4474  ->willReturn($return);
4475  self::assertSame(
4476  $return,
4477  ‪$subject->stdWrap_crop($content, $conf)
4478  );
4479  }
4480 
4493  public function ‪stdWrap_cropHTML(): void
4494  {
4495  $content = ‪StringUtility::getUniqueId('content');
4496  $conf = [
4497  'cropHTML' => ‪StringUtility::getUniqueId('cropHTML'),
4498  'cropHTML.' => ‪StringUtility::getUniqueId('not used'),
4499  ];
4500  $return = ‪StringUtility::getUniqueId('return');
4501  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
4502  ->onlyMethods(['cropHTML'])->getMock();
4503  ‪$subject
4504  ->expects(self::once())
4505  ->method('cropHTML')
4506  ->with($content, $conf['cropHTML'])
4507  ->willReturn($return);
4508  self::assertSame(
4509  $return,
4510  ‪$subject->stdWrap_cropHTML($content, $conf)
4511  );
4512  }
4513 
4519  public function ‪stdWrap_csConvDataProvider(): array
4520  {
4521  return [
4522  'empty string from ISO-8859-15' => [
4523  '',
4524  mb_convert_encoding('', 'ISO-8859-15', 'UTF-8'),
4525  ['csConv' => 'ISO-8859-15'],
4526  ],
4527  'empty string from BIG-5' => [
4528  '',
4529  mb_convert_encoding('', 'BIG-5'),
4530  ['csConv' => 'BIG-5'],
4531  ],
4532  '"0" from ISO-8859-15' => [
4533  '0',
4534  mb_convert_encoding('0', 'ISO-8859-15', 'UTF-8'),
4535  ['csConv' => 'ISO-8859-15'],
4536  ],
4537  '"0" from BIG-5' => [
4538  '0',
4539  mb_convert_encoding('0', 'BIG-5'),
4540  ['csConv' => 'BIG-5'],
4541  ],
4542  'euro symbol from ISO-88859-15' => [
4543  '€',
4544  mb_convert_encoding('€', 'ISO-8859-15', 'UTF-8'),
4545  ['csConv' => 'ISO-8859-15'],
4546  ],
4547  'good morning from BIG-5' => [
4548  '早安',
4549  mb_convert_encoding('早安', 'BIG-5'),
4550  ['csConv' => 'BIG-5'],
4551  ],
4552  ];
4553  }
4554 
4564  public function ‪stdWrap_csConv(string $expected, string $input, array $conf): void
4565  {
4566  self::assertSame(
4567  $expected,
4568  $this->subject->stdWrap_csConv($input, $conf)
4569  );
4570  }
4571 
4583  public function ‪stdWrap_current(): void
4584  {
4585  $data = [
4586  'currentValue_kidjls9dksoje' => 'default',
4587  'currentValue_new' => 'new',
4588  ];
4589  $this->subject->_set('data', $data);
4590  self::assertSame(
4591  'currentValue_kidjls9dksoje',
4592  $this->subject->_get('currentValKey')
4593  );
4594  self::assertSame(
4595  'default',
4596  $this->subject->stdWrap_current('discarded', ['discarded'])
4597  );
4598  $this->subject->_set('currentValKey', 'currentValue_new');
4599  self::assertSame(
4600  'new',
4601  $this->subject->stdWrap_current('discarded', ['discarded'])
4602  );
4603  }
4604 
4610  public function ‪stdWrap_dataDataProvider(): array
4611  {
4612  $data = [‪StringUtility::getUniqueId('data')];
4613  $alt = [‪StringUtility::getUniqueId('alternativeData')];
4614  return [
4615  'default' => [$data, $data, ''],
4616  'alt is array' => [$alt, $data, $alt],
4617  'alt is empty array' => [[], $data, []],
4618  'alt null' => [$data, $data, null],
4619  'alt string' => [$data, $data, 'xxx'],
4620  'alt int' => [$data, $data, 1],
4621  'alt bool' => [$data, $data, true],
4622  ];
4623  }
4624 
4643  public function ‪stdWrap_data(array $expect, array $data, $alt): void
4644  {
4645  $conf = ['data' => ‪StringUtility::getUniqueId('conf.data')];
4646  $return = ‪StringUtility::getUniqueId('return');
4647  ‪$subject = $this->getAccessibleMock(
4648  ContentObjectRenderer::class,
4649  ['getData']
4650  );
4651  ‪$subject->_set('data', $data);
4652  ‪$subject->_set('alternativeData', $alt);
4653  ‪$subject
4654  ->expects(self::once())
4655  ->method('getData')
4656  ->with($conf['data'], $expect)
4657  ->willReturn($return);
4658  self::assertSame($return, ‪$subject->stdWrap_data('discard', $conf));
4659  self::assertSame('', ‪$subject->_get('alternativeData'));
4660  }
4661 
4674  public function ‪stdWrap_dataWrap(): void
4675  {
4676  $content = ‪StringUtility::getUniqueId('content');
4677  $conf = [
4678  'dataWrap' => ‪StringUtility::getUniqueId('dataWrap'),
4679  'dataWrap.' => [‪StringUtility::getUniqueId('not used')],
4680  ];
4681  $return = ‪StringUtility::getUniqueId('return');
4682  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
4683  ->onlyMethods(['dataWrap'])->getMock();
4684  ‪$subject
4685  ->expects(self::once())
4686  ->method('dataWrap')
4687  ->with($content, $conf['dataWrap'])
4688  ->willReturn($return);
4689  self::assertSame(
4690  $return,
4691  ‪$subject->stdWrap_dataWrap($content, $conf)
4692  );
4693  }
4694 
4700  public function ‪stdWrap_dateDataProvider(): array
4701  {
4702  // Fictive execution time: 2015-10-02 12:00
4703  $now = 1443780000;
4704  return [
4705  'given timestamp' => [
4706  '02.10.2015',
4707  $now,
4708  ['date' => 'd.m.Y'],
4709  $now,
4710  ],
4711  'empty string' => [
4712  '02.10.2015',
4713  '',
4714  ['date' => 'd.m.Y'],
4715  $now,
4716  ],
4717  'testing null' => [
4718  '02.10.2015',
4719  null,
4720  ['date' => 'd.m.Y'],
4721  $now,
4722  ],
4723  'given timestamp return GMT' => [
4724  '02.10.2015 10:00:00',
4725  $now,
4726  [
4727  'date' => 'd.m.Y H:i:s',
4728  'date.' => ['GMT' => true],
4729  ],
4730  $now,
4731  ],
4732  ];
4733  }
4734 
4745  public function ‪stdWrap_date(string $expected, $content, array $conf, int $now): void
4746  {
4747  ‪$GLOBALS['EXEC_TIME'] = $now;
4748  self::assertEquals(
4749  $expected,
4750  $this->subject->stdWrap_date($content, $conf)
4751  );
4752  }
4753 
4759  public function ‪stdWrap_debug(): void
4760  {
4761  $expect = '<pre>&lt;p class=&quot;class&quot;&gt;&lt;br/&gt;'
4762  . '&lt;/p&gt;</pre>';
4763  $content = '<p class="class"><br/></p>';
4764  self::assertSame($expect, $this->subject->stdWrap_debug($content));
4765  }
4766 
4793  public function ‪stdWrap_debugData(): void
4794  {
4795  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
4796  $content = ‪StringUtility::getUniqueId('content');
4797  $key = ‪StringUtility::getUniqueId('key');
4798  $value = ‪StringUtility::getUniqueId('value');
4799  $altValue = ‪StringUtility::getUniqueId('value alt');
4800  $this->subject->data = [$key => $value];
4801  // Without alternative data only data is returned.
4802  ob_start();
4803  $result = $this->subject->stdWrap_debugData($content);
4804  $out = ob_get_clean();
4805  self::assertSame($result, $content);
4806  self::assertStringContainsString('$cObj->data', $out);
4807  self::assertStringContainsString($value, $out);
4808  self::assertStringNotContainsString($altValue, $out);
4809  // By adding alternative data both are returned together.
4810  $this->subject->alternativeData = [$key => $altValue];
4811  ob_start();
4812  $this->subject->stdWrap_debugData($content);
4813  $out = ob_get_clean();
4814  self::assertStringNotContainsString('$cObj->alternativeData', $out);
4815  self::assertStringContainsString($value, $out);
4816  self::assertStringContainsString($altValue, $out);
4817  }
4818 
4824  public function ‪stdWrap_debugFuncDataProvider(): array
4825  {
4826  return [
4827  'expect array by string' => [true, '2'],
4828  'expect array by integer' => [true, 2],
4829  'do not expect array' => [false, ''],
4830  ];
4831  }
4832 
4854  public function ‪stdWrap_debugFunc(bool $expectArray, $confDebugFunc): void
4855  {
4856  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
4857  $content = ‪StringUtility::getUniqueId('content');
4858  $conf = ['debugFunc' => $confDebugFunc];
4859  ob_start();
4860  $result = $this->subject->stdWrap_debugFunc($content, $conf);
4861  $out = ob_get_clean();
4862  self::assertSame($result, $content);
4863  self::assertStringContainsString($content, $out);
4864  if ($expectArray) {
4865  self::assertStringContainsString('=>', $out);
4866  } else {
4867  self::assertStringNotContainsString('=>', $out);
4868  }
4869  }
4870 
4876  public function ‪stdWrapDoubleBrTagDataProvider(): array
4877  {
4878  return [
4879  'no config: void input' => [
4880  '',
4881  '',
4882  [],
4883  ],
4884  'no config: single break' => [
4885  'one' . LF . 'two',
4886  'one' . LF . 'two',
4887  [],
4888  ],
4889  'no config: double break' => [
4890  'onetwo',
4891  'one' . LF . LF . 'two',
4892  [],
4893  ],
4894  'no config: double break with whitespace' => [
4895  'onetwo',
4896  'one' . LF . "\t" . ' ' . "\t" . ' ' . LF . 'two',
4897  [],
4898  ],
4899  'no config: single break around' => [
4900  LF . 'one' . LF,
4901  LF . 'one' . LF,
4902  [],
4903  ],
4904  'no config: double break around' => [
4905  'one',
4906  LF . LF . 'one' . LF . LF,
4907  [],
4908  ],
4909  'empty string: double break around' => [
4910  'one',
4911  LF . LF . 'one' . LF . LF,
4912  ['doubleBrTag' => ''],
4913  ],
4914  'br tag: double break' => [
4915  'one<br/>two',
4916  'one' . LF . LF . 'two',
4917  ['doubleBrTag' => '<br/>'],
4918  ],
4919  'br tag: double break around' => [
4920  '<br/>one<br/>',
4921  LF . LF . 'one' . LF . LF,
4922  ['doubleBrTag' => '<br/>'],
4923  ],
4924  'double br tag: double break around' => [
4925  '<br/><br/>one<br/><br/>',
4926  LF . LF . 'one' . LF . LF,
4927  ['doubleBrTag' => '<br/><br/>'],
4928  ],
4929  ];
4930  }
4931 
4941  public function ‪stdWrap_doubleBrTag(string $expected, string $input, array $config): void
4942  {
4943  self::assertEquals($expected, $this->subject->stdWrap_doubleBrTag($input, $config));
4944  }
4945 
4958  public function ‪stdWrap_encapsLines(): void
4959  {
4960  $content = ‪StringUtility::getUniqueId('content');
4961  $conf = [
4962  'encapsLines' => [‪StringUtility::getUniqueId('not used')],
4963  'encapsLines.' => [‪StringUtility::getUniqueId('encapsLines.')],
4964  ];
4965  $return = ‪StringUtility::getUniqueId('return');
4966  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
4967  ->onlyMethods(['encaps_lineSplit'])->getMock();
4968  ‪$subject
4969  ->expects(self::once())
4970  ->method('encaps_lineSplit')
4971  ->with($content, $conf['encapsLines.'])
4972  ->willReturn($return);
4973  self::assertSame(
4974  $return,
4975  ‪$subject->stdWrap_encapsLines($content, $conf)
4976  );
4977  }
4978 
4989  public function ‪stdWrap_encapsLines_HTML5SelfClosingTags(string $input, string $expected): void
4990  {
4991  $rteParseFunc = $this->getLibParseFunc_RTE();
4992 
4993  $conf = [
4994  'encapsLines' => $rteParseFunc['parseFunc.']['nonTypoTagStdWrap.']['encapsLines'] ?? null,
4995  'encapsLines.' => $rteParseFunc['parseFunc.']['nonTypoTagStdWrap.']['encapsLines.'] ?? null,
4996  ];
4997  // don't add an &nbsp; to tag without content
4998  $conf['encapsLines.']['innerStdWrap_all.']['ifBlank'] = '';
4999  $additionalEncapsTags = ['a', 'b', 'span'];
5000 
5001  // We want to allow any tag to be an encapsulating tag
5002  // since this is possible and we don't want an additional tag to be wrapped around.
5003  $conf['encapsLines.']['encapsTagList'] .= ',' . implode(',', $additionalEncapsTags);
5004  $conf['encapsLines.']['encapsTagList'] .= ',' . implode(',', [$input]);
5005 
5006  // Check if we get a self-closing tag for
5007  // empty tags where this is allowed according to HTML5
5008  $content = '<' . $input . ' id="myId" class="bodytext" />';
5009  $result = $this->subject->stdWrap_encapsLines($content, $conf);
5010  self::assertSame($expected, $result);
5011  }
5012 
5016  public function ‪html5SelfClosingTagsDataprovider(): array
5017  {
5018  return [
5019  'areaTag_selfclosing' => [
5020  'input' => 'area',
5021  'expected' => '<area id="myId" class="bodytext" />',
5022  ],
5023  'base_selfclosing' => [
5024  'input' => 'base',
5025  'expected' => '<base id="myId" class="bodytext" />',
5026  ],
5027  'br_selfclosing' => [
5028  'input' => 'br',
5029  'expected' => '<br id="myId" class="bodytext" />',
5030  ],
5031  'col_selfclosing' => [
5032  'input' => 'col',
5033  'expected' => '<col id="myId" class="bodytext" />',
5034  ],
5035  'embed_selfclosing' => [
5036  'input' => 'embed',
5037  'expected' => '<embed id="myId" class="bodytext" />',
5038  ],
5039  'hr_selfclosing' => [
5040  'input' => 'hr',
5041  'expected' => '<hr id="myId" class="bodytext" />',
5042  ],
5043  'img_selfclosing' => [
5044  'input' => 'img',
5045  'expected' => '<img id="myId" class="bodytext" />',
5046  ],
5047  'input_selfclosing' => [
5048  'input' => 'input',
5049  'expected' => '<input id="myId" class="bodytext" />',
5050  ],
5051  'keygen_selfclosing' => [
5052  'input' => 'keygen',
5053  'expected' => '<keygen id="myId" class="bodytext" />',
5054  ],
5055  'link_selfclosing' => [
5056  'input' => 'link',
5057  'expected' => '<link id="myId" class="bodytext" />',
5058  ],
5059  'meta_selfclosing' => [
5060  'input' => 'meta',
5061  'expected' => '<meta id="myId" class="bodytext" />',
5062  ],
5063  'param_selfclosing' => [
5064  'input' => 'param',
5065  'expected' => '<param id="myId" class="bodytext" />',
5066  ],
5067  'source_selfclosing' => [
5068  'input' => 'source',
5069  'expected' => '<source id="myId" class="bodytext" />',
5070  ],
5071  'track_selfclosing' => [
5072  'input' => 'track',
5073  'expected' => '<track id="myId" class="bodytext" />',
5074  ],
5075  'wbr_selfclosing' => [
5076  'input' => 'wbr',
5077  'expected' => '<wbr id="myId" class="bodytext" />',
5078  ],
5079  'p_notselfclosing' => [
5080  'input' => 'p',
5081  'expected' => '<p id="myId" class="bodytext"></p>',
5082  ],
5083  'a_notselfclosing' => [
5084  'input' => 'a',
5085  'expected' => '<a id="myId" class="bodytext"></a>',
5086  ],
5087  'strong_notselfclosing' => [
5088  'input' => 'strong',
5089  'expected' => '<strong id="myId" class="bodytext"></strong>',
5090  ],
5091  'span_notselfclosing' => [
5092  'input' => 'span',
5093  'expected' => '<span id="myId" class="bodytext"></span>',
5094  ],
5095  ];
5096  }
5097 
5103  public function ‪stdWrap_encodeForJavaScriptValueDataProvider(): array
5104  {
5105  return [
5106  'double quote in string' => [
5107  '\'double\u0020quote\u0022\'',
5108  'double quote"',
5109  ],
5110  'backslash in string' => [
5111  '\'backslash\u0020\u005C\'',
5112  'backslash \\',
5113  ],
5114  'exclamation mark' => [
5115  '\'exclamation\u0021\'',
5116  'exclamation!',
5117  ],
5118  'whitespace tab, newline and carriage return' => [
5119  '\'white\u0009space\u000As\u000D\'',
5120  "white\tspace\ns\r",
5121  ],
5122  'single quote in string' => [
5123  '\'single\u0020quote\u0020\u0027\'',
5124  'single quote \'',
5125  ],
5126  'tag' => [
5127  '\'\u003Ctag\u003E\'',
5128  '<tag>',
5129  ],
5130  'ampersand in string' => [
5131  '\'amper\u0026sand\'',
5132  'amper&sand',
5133  ],
5134  ];
5135  }
5136 
5145  public function ‪stdWrap_encodeForJavaScriptValue(string $expect, string $content): void
5146  {
5147  self::assertSame(
5148  $expect,
5149  $this->subject->stdWrap_encodeForJavaScriptValue($content)
5150  );
5151  }
5152 
5158  public function ‪stdWrap_expandListDataProvider(): array
5159  {
5160  return [
5161  'numbers' => ['1,2,3', '1,2,3'],
5162  'range' => ['3,4,5', '3-5'],
5163  'numbers and range' => ['1,3,4,5,7', '1,3-5,7'],
5164  ];
5165  }
5166 
5180  public function ‪stdWrap_expandList(string $expected, string $content): void
5181  {
5182  self::assertEquals(
5183  $expected,
5184  $this->subject->stdWrap_expandList($content)
5185  );
5186  }
5187 
5198  public function ‪stdWrap_field(): void
5199  {
5200  $expect = ‪StringUtility::getUniqueId('expect');
5201  $conf = ['field' => ‪StringUtility::getUniqueId('field')];
5202  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
5203  ->onlyMethods(['getFieldVal'])->getMock();
5204  ‪$subject
5205  ->expects(self::once())
5206  ->method('getFieldVal')
5207  ->with($conf['field'])
5208  ->willReturn($expect);
5209  self::assertSame(
5210  $expect,
5211  ‪$subject->stdWrap_field('discarded', $conf)
5212  );
5213  }
5214 
5220  public function ‪stdWrap_fieldRequiredDataProvider(): array
5221  {
5222  $content = ‪StringUtility::getUniqueId('content');
5223  return [
5224  // resulting in boolean false
5225  'false is false' => [
5226  '',
5227  true,
5228  $content,
5229  ['fieldRequired' => 'false'],
5230  ],
5231  'null is false' => [
5232  '',
5233  true,
5234  $content,
5235  ['fieldRequired' => 'null'],
5236  ],
5237  'empty string is false' => [
5238  '',
5239  true,
5240  $content,
5241  ['fieldRequired' => 'empty'],
5242  ],
5243  'whitespace is false' => [
5244  '',
5245  true,
5246  $content,
5247  ['fieldRequired' => 'whitespace'],
5248  ],
5249  'string zero is false' => [
5250  '',
5251  true,
5252  $content,
5253  ['fieldRequired' => 'stringZero'],
5254  ],
5255  'string zero with whitespace is false' => [
5256  '',
5257  true,
5258  $content,
5259  ['fieldRequired' => 'stringZeroWithWhiteSpace'],
5260  ],
5261  'zero is false' => [
5262  '',
5263  true,
5264  $content,
5265  ['fieldRequired' => 'zero'],
5266  ],
5267  // resulting in boolean true
5268  'true is true' => [
5269  $content,
5270  false,
5271  $content,
5272  ['fieldRequired' => 'true'],
5273  ],
5274  'string is true' => [
5275  $content,
5276  false,
5277  $content,
5278  ['fieldRequired' => 'string'],
5279  ],
5280  'one is true' => [
5281  $content,
5282  false,
5283  $content,
5284  ['fieldRequired' => 'one'],
5285  ],
5286  ];
5287  }
5288 
5308  public function ‪stdWrap_fieldRequired(string $expect, bool $stop, string $content, array $conf): void
5309  {
5310  $data = [
5311  'null' => null,
5312  'false' => false,
5313  'empty' => '',
5314  'whitespace' => "\t" . ' ',
5315  'stringZero' => '0',
5316  'stringZeroWithWhiteSpace' => "\t" . ' 0 ' . "\t",
5317  'zero' => 0,
5318  'string' => 'string',
5319  'true' => true,
5320  'one' => 1,
5321  ];
5323  ‪$subject->_set('data', $data);
5324  ‪$subject->_set('stdWrapRecursionLevel', 1);
5325  ‪$subject->_set('stopRendering', [1 => false]);
5326  self::assertSame(
5327  $expect,
5328  ‪$subject->stdWrap_fieldRequired($content, $conf)
5329  );
5330  self::assertSame($stop, ‪$subject->_get('stopRendering')[1]);
5331  }
5332 
5338  public function ‪hashDataProvider(): array
5339  {
5340  return [
5341  'md5' => [
5342  'bacb98acf97e0b6112b1d1b650b84971',
5343  'joh316',
5344  ['hash' => 'md5'],
5345  ],
5346  'sha1' => [
5347  '063b3d108bed9f88fa618c6046de0dccadcf3158',
5348  'joh316',
5349  ['hash' => 'sha1'],
5350  ],
5351  'stdWrap capability' => [
5352  'bacb98acf97e0b6112b1d1b650b84971',
5353  'joh316',
5354  [
5355  'hash' => '5',
5356  'hash.' => ['wrap' => 'md|'],
5357  ],
5358  ],
5359  'non-existing hashing algorithm' => [
5360  '',
5361  'joh316',
5362  ['hash' => 'non-existing'],
5363  ],
5364  ];
5365  }
5366 
5382  public function ‪stdWrap_hash(string $expect, string $content, array $conf): void
5383  {
5384  self::assertSame(
5385  $expect,
5386  $this->subject->stdWrap_hash($content, $conf)
5387  );
5388  }
5389 
5395  public function ‪stdWrap_htmlSpecialCharsDataProvider(): array
5396  {
5397  return [
5398  'void conf' => [
5399  '&lt;span&gt;1 &amp;lt; 2&lt;/span&gt;',
5400  '<span>1 &lt; 2</span>',
5401  [],
5402  ],
5403  'void preserveEntities' => [
5404  '&lt;span&gt;1 &amp;lt; 2&lt;/span&gt;',
5405  '<span>1 &lt; 2</span>',
5406  ['htmlSpecialChars.' => []],
5407  ],
5408  'false preserveEntities' => [
5409  '&lt;span&gt;1 &amp;lt; 2&lt;/span&gt;',
5410  '<span>1 &lt; 2</span>',
5411  ['htmlSpecialChars.' => ['preserveEntities' => 0]],
5412  ],
5413  'true preserveEntities' => [
5414  '&lt;span&gt;1 &lt; 2&lt;/span&gt;',
5415  '<span>1 &lt; 2</span>',
5416  ['htmlSpecialChars.' => ['preserveEntities' => 1]],
5417  ],
5418  ];
5419  }
5420 
5430  public function ‪stdWrap_htmlSpecialChars(string $expected, string $input, array $conf): void
5431  {
5432  self::assertSame(
5433  $expected,
5434  $this->subject->stdWrap_htmlSpecialChars($input, $conf)
5435  );
5436  }
5437 
5443  public function ‪stdWrap_ifDataProvider(): array
5444  {
5445  $content = ‪StringUtility::getUniqueId('content');
5446  $conf = ['if.' => [‪StringUtility::getUniqueId('if.')]];
5447  return [
5448  // evals to true
5449  'empty config' => [
5450  $content,
5451  false,
5452  $content,
5453  [],
5454  0,
5455  null,
5456  ],
5457  'if. is empty array' => [
5458  $content,
5459  false,
5460  $content,
5461  ['if.' => []],
5462  0,
5463  null,
5464  ],
5465  'if. is null' => [
5466  $content,
5467  false,
5468  $content,
5469  ['if.' => null],
5470  0,
5471  null,
5472  ],
5473  'if. is false' => [
5474  $content,
5475  false,
5476  $content,
5477  ['if.' => false],
5478  0,
5479  null,
5480  ],
5481  'if. is 0' => [
5482  $content,
5483  false,
5484  $content,
5485  ['if.' => false],
5486  0,
5487  null,
5488  ],
5489  'if. is "0"' => [
5490  $content,
5491  false,
5492  $content,
5493  ['if.' => '0'],
5494  0,
5495  null,
5496  ],
5497  'checkIf returning true' => [
5498  $content,
5499  false,
5500  $content,
5501  $conf,
5502  1,
5503  true,
5504  ],
5505  // evals to false
5506  'checkIf returning false' => [
5507  '',
5508  true,
5509  $content,
5510  $conf,
5511  1,
5512  false,
5513  ],
5514  ];
5515  }
5516 
5537  public function ‪stdWrap_if(string $expect, bool $stop, string $content, array $conf, int $times, ?bool $will): void
5538  {
5539  ‪$subject = $this->getAccessibleMock(
5540  ContentObjectRenderer::class,
5541  ['checkIf']
5542  );
5543  ‪$subject->_set('stdWrapRecursionLevel', 1);
5544  ‪$subject->_set('stopRendering', [1 => false]);
5545  ‪$subject
5546  ->expects(self::exactly($times))
5547  ->method('checkIf')
5548  ->with($conf['if.'] ?? null)
5549  ->willReturn($will);
5550  self::assertSame($expect, ‪$subject->stdWrap_if($content, $conf));
5551  self::assertSame($stop, ‪$subject->_get('stopRendering')[1]);
5552  }
5553 
5559  public function ‪checkIfDataProvider(): array
5560  {
5561  return [
5562  'true bitAnd the same' => [true, ['bitAnd' => '4', 'value' => '4']],
5563  'true bitAnd included' => [true, ['bitAnd' => '6', 'value' => '4']],
5564  'false bitAnd' => [false, ['bitAnd' => '4', 'value' => '3']],
5565  'negate true bitAnd the same' => [false, ['bitAnd' => '4', 'value' => '4', 'negate' => '1']],
5566  'negate true bitAnd included' => [false, ['bitAnd' => '6', 'value' => '4', 'negate' => '1']],
5567  'negate false bitAnd' => [true, ['bitAnd' => '3', 'value' => '4', 'negate' => '1']],
5568  ];
5569  }
5570 
5579  public function ‪checkIf(bool $expect, array $conf): void
5580  {
5581  ‪$subject = $this->getAccessibleMock(
5582  ContentObjectRenderer::class,
5583  ['stdWrap']
5584  );
5585  self::assertSame($expect, ‪$subject->checkIf($conf));
5586  }
5587 
5593  public function ‪stdWrap_ifBlankDataProvider(): array
5594  {
5595  $alt = ‪StringUtility::getUniqueId('alternative content');
5596  $conf = ['ifBlank' => $alt];
5597  return [
5598  // blank cases
5599  'null is blank' => [$alt, null, $conf],
5600  'false is blank' => [$alt, false, $conf],
5601  'empty string is blank' => [$alt, '', $conf],
5602  'whitespace is blank' => [$alt, "\t" . '', $conf],
5603  // non-blank cases
5604  'string is not blank' => ['string', 'string', $conf],
5605  'zero is not blank' => [0, 0, $conf],
5606  'zero string is not blank' => ['0', '0', $conf],
5607  'zero float is not blank' => [0.0, 0.0, $conf],
5608  'true is not blank' => [true, true, $conf],
5609  ];
5610  }
5611 
5628  public function ‪stdWrap_ifBlank($expect, $content, array $conf): void
5629  {
5630  $result = $this->subject->stdWrap_ifBlank($content, $conf);
5631  self::assertSame($expect, $result);
5632  }
5633 
5639  public function ‪stdWrap_ifEmptyDataProvider(): array
5640  {
5641  $alt = ‪StringUtility::getUniqueId('alternative content');
5642  $conf = ['ifEmpty' => $alt];
5643  return [
5644  // empty cases
5645  'null is empty' => [$alt, null, $conf],
5646  'false is empty' => [$alt, false, $conf],
5647  'zero is empty' => [$alt, 0, $conf],
5648  'float zero is empty' => [$alt, 0.0, $conf],
5649  'whitespace is empty' => [$alt, "\t" . ' ', $conf],
5650  'empty string is empty' => [$alt, '', $conf],
5651  'zero string is empty' => [$alt, '0', $conf],
5652  'zero string is empty with whitespace' => [
5653  $alt,
5654  "\t" . ' 0 ' . "\t",
5655  $conf,
5656  ],
5657  // non-empty cases
5658  'string is not empty' => ['string', 'string', $conf],
5659  '1 is not empty' => [1, 1, $conf],
5660  '-1 is not empty' => [-1, -1, $conf],
5661  '0.1 is not empty' => [0.1, 0.1, $conf],
5662  '-0.1 is not empty' => [-0.1, -0.1, $conf],
5663  'true is not empty' => [true, true, $conf],
5664  ];
5665  }
5666 
5682  public function ‪stdWrap_ifEmpty($expect, $content, array $conf): void
5683  {
5684  $result = $this->subject->stdWrap_ifEmpty($content, $conf);
5685  self::assertSame($expect, $result);
5686  }
5687 
5693  public function ‪stdWrap_ifNullDataProvider(): array
5694  {
5695  $alt = ‪StringUtility::getUniqueId('alternative content');
5696  $conf = ['ifNull' => $alt];
5697  return [
5698  'only null is null' => [$alt, null, $conf],
5699  'zero is not null' => [0, 0, $conf],
5700  'float zero is not null' => [0.0, 0.0, $conf],
5701  'false is not null' => [false, false, $conf],
5702  'zero string is not null' => ['0', '0', $conf],
5703  'empty string is not null' => ['', '', $conf],
5704  'whitespace is not null' => ["\t" . '', "\t" . '', $conf],
5705  ];
5706  }
5707 
5723  public function ‪stdWrap_ifNull($expect, $content, array $conf): void
5724  {
5725  $result = $this->subject->stdWrap_ifNull($content, $conf);
5726  self::assertSame($expect, $result);
5727  }
5728 
5734  public function ‪stdWrap_innerWrapDataProvider(): array
5735  {
5736  return [
5737  'no conf' => [
5738  'XXX',
5739  'XXX',
5740  [],
5741  ],
5742  'simple' => [
5743  '<wrap>XXX</wrap>',
5744  'XXX',
5745  ['innerWrap' => '<wrap>|</wrap>'],
5746  ],
5747  'missing pipe puts wrap before' => [
5748  '<pre>XXX',
5749  'XXX',
5750  ['innerWrap' => '<pre>'],
5751  ],
5752  'trims whitespace' => [
5753  '<wrap>XXX</wrap>',
5754  'XXX',
5755  ['innerWrap' => '<wrap>' . "\t" . ' | ' . "\t" . '</wrap>'],
5756  ],
5757  'split char change is not possible' => [
5758  '<wrap> # </wrap>XXX',
5759  'XXX',
5760  [
5761  'innerWrap' => '<wrap> # </wrap>',
5762  'innerWrap.' => ['splitChar' => '#'],
5763  ],
5764  ],
5765  ];
5766  }
5767 
5777  public function ‪stdWrap_innerWrap(string $expected, string $input, array $conf): void
5778  {
5779  self::assertSame(
5780  $expected,
5781  $this->subject->stdWrap_innerWrap($input, $conf)
5782  );
5783  }
5784 
5790  public function ‪stdWrap_innerWrap2DataProvider(): array
5791  {
5792  return [
5793  'no conf' => [
5794  'XXX',
5795  'XXX',
5796  [],
5797  ],
5798  'simple' => [
5799  '<wrap>XXX</wrap>',
5800  'XXX',
5801  ['innerWrap2' => '<wrap>|</wrap>'],
5802  ],
5803  'missing pipe puts wrap before' => [
5804  '<pre>XXX',
5805  'XXX',
5806  ['innerWrap2' => '<pre>'],
5807  ],
5808  'trims whitespace' => [
5809  '<wrap>XXX</wrap>',
5810  'XXX',
5811  ['innerWrap2' => '<wrap>' . "\t" . ' | ' . "\t" . '</wrap>'],
5812  ],
5813  'split char change is not possible' => [
5814  '<wrap> # </wrap>XXX',
5815  'XXX',
5816  [
5817  'innerWrap2' => '<wrap> # </wrap>',
5818  'innerWrap2.' => ['splitChar' => '#'],
5819  ],
5820  ],
5821  ];
5822  }
5823 
5833  public function ‪stdWrap_innerWrap2(string $expected, string $input, array $conf): void
5834  {
5835  self::assertSame(
5836  $expected,
5837  $this->subject->stdWrap_innerWrap2($input, $conf)
5838  );
5839  }
5840 
5852  public function ‪stdWrap_insertData(): void
5853  {
5854  $content = ‪StringUtility::getUniqueId('content');
5855  $return = ‪StringUtility::getUniqueId('return');
5856  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
5857  ->onlyMethods(['insertData'])->getMock();
5858  ‪$subject->expects(self::once())->method('insertData')
5859  ->with($content)->willReturn($return);
5860  self::assertSame(
5861  $return,
5862  ‪$subject->stdWrap_insertData($content)
5863  );
5864  }
5865 
5871  public function ‪stdWrap_insertDataProvider(): array
5872  {
5873  return [
5874  'empty' => ['', ''],
5875  'notFoundData' => ['any=1', 'any{$string}=1'],
5876  'queryParameter' => ['any{#string}=1', 'any{#string}=1'],
5877  ];
5878  }
5879 
5888  public function ‪stdWrap_insertDataAndInputExamples($expect, string $content): void
5889  {
5890  self::assertSame($expect, $this->subject->stdWrap_insertData($content));
5891  }
5892 
5898  public function ‪stdWrap_intvalDataProvider(): array
5899  {
5900  return [
5901  // numbers
5902  'int' => [123, 123],
5903  'float' => [123, 123.45],
5904  'float does not round up' => [123, 123.55],
5905  // negative numbers
5906  'negative int' => [-123, -123],
5907  'negative float' => [-123, -123.45],
5908  'negative float does not round down' => [-123, -123.55],
5909  // strings
5910  'word string' => [0, 'string'],
5911  'empty string' => [0, ''],
5912  'zero string' => [0, '0'],
5913  'int string' => [123, '123'],
5914  'float string' => [123, '123.55'],
5915  'negative float string' => [-123, '-123.55'],
5916  // other types
5917  'null' => [0, null],
5918  'true' => [1, true],
5919  'false' => [0, false],
5920  ];
5921  }
5922 
5942  public function ‪stdWrap_intval(int $expect, $content): void
5943  {
5944  self::assertSame($expect, $this->subject->stdWrap_intval($content));
5945  }
5946 
5952  public function ‪stdWrapKeywordsDataProvider(): array
5953  {
5954  return [
5955  'empty string' => ['', ''],
5956  'blank' => ['', ' '],
5957  'tab' => ['', "\t"],
5958  'single semicolon' => [',', ' ; '],
5959  'single comma' => [',', ' , '],
5960  'single nl' => [',', ' ' . PHP_EOL . ' '],
5961  'double semicolon' => [',,', ' ; ; '],
5962  'double comma' => [',,', ' , , '],
5963  'double nl' => [',,', ' ' . PHP_EOL . ' ' . PHP_EOL . ' '],
5964  'simple word' => ['one', ' one '],
5965  'simple word trimmed' => ['one', 'one'],
5966  ', separated' => ['one,two', ' one , two '],
5967  '; separated' => ['one,two', ' one ; two '],
5968  'nl separated' => ['one,two', ' one ' . PHP_EOL . ' two '],
5969  ', typical' => ['one,two,three', 'one, two, three'],
5970  '; typical' => ['one,two,three', ' one; two; three'],
5971  'nl typical' => [
5972  'one,two,three',
5973  'one' . PHP_EOL . 'two' . PHP_EOL . 'three',
5974  ],
5975  ', sourounded' => [',one,two,', ' , one , two , '],
5976  '; sourounded' => [',one,two,', ' ; one ; two ; '],
5977  'nl sourounded' => [
5978  ',one,two,',
5979  ' ' . PHP_EOL . ' one ' . PHP_EOL . ' two ' . PHP_EOL . ' ',
5980  ],
5981  'mixed' => [
5982  'one,two,three,four',
5983  ' one, two; three' . PHP_EOL . 'four',
5984  ],
5985  'keywods with blanks in words' => [
5986  'one plus,two minus',
5987  ' one plus , two minus ',
5988  ],
5989  ];
5990  }
5991 
6000  public function ‪stdWrap_keywords(string $expected, string $input): void
6001  {
6002  self::assertSame($expected, $this->subject->stdWrap_keywords($input));
6003  }
6004 
6010  public function ‪stdWrap_langDataProvider(): array
6011  {
6012  return [
6013  'empty conf' => [
6014  'original',
6015  'original',
6016  [],
6017  'de',
6018  ],
6019  'translation de' => [
6020  'Ãœbersetzung',
6021  'original',
6022  [
6023  'lang.' => [
6024  'de' => 'Ãœbersetzung',
6025  'it' => 'traduzione',
6026  ],
6027  ],
6028  'de',
6029  ],
6030  'translation it' => [
6031  'traduzione',
6032  'original',
6033  [
6034  'lang.' => [
6035  'de' => 'Ãœbersetzung',
6036  'it' => 'traduzione',
6037  ],
6038  ],
6039  'it',
6040  ],
6041  'no translation' => [
6042  'original',
6043  'original',
6044  [
6045  'lang.' => [
6046  'de' => 'Ãœbersetzung',
6047  'it' => 'traduzione',
6048  ],
6049  ],
6050  '',
6051  ],
6052  'missing label' => [
6053  'original',
6054  'original',
6055  [
6056  'lang.' => [
6057  'de' => 'Ãœbersetzung',
6058  'it' => 'traduzione',
6059  ],
6060  ],
6061  'fr',
6062  ],
6063  ];
6064  }
6065 
6076  public function ‪stdWrap_langViaSiteLanguage(string $expected, string $input, array $conf, string $language): void
6077  {
6078  $site = $this->createSiteWithLanguage([
6079  'base' => '/',
6080  'languageId' => 2,
6081  'locale' => 'en_UK',
6082  'typo3Language' => $language,
6083  ]);
6084  $this->frontendControllerMock->_set('language', $site->getLanguageById(2));
6085  self::assertSame(
6086  $expected,
6087  $this->subject->stdWrap_lang($input, $conf)
6088  );
6089  }
6090 
6104  public function ‪stdWrap_listNum(): void
6105  {
6106  $content = ‪StringUtility::getUniqueId('content');
6107  $conf = [
6108  'listNum' => ‪StringUtility::getUniqueId('listNum'),
6109  'listNum.' => [
6110  'splitChar' => ‪StringUtility::getUniqueId('splitChar'),
6111  ],
6112  ];
6113  $return = ‪StringUtility::getUniqueId('return');
6114  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6115  ->onlyMethods(['listNum'])->getMock();
6116  ‪$subject
6117  ->expects(self::once())
6118  ->method('listNum')
6119  ->with(
6120  $content,
6121  $conf['listNum'],
6122  $conf['listNum.']['splitChar']
6123  )
6124  ->willReturn($return);
6125  self::assertSame(
6126  $return,
6127  ‪$subject->stdWrap_listNum($content, $conf)
6128  );
6129  }
6130 
6136  public function ‪stdWrap_noTrimWrapDataProvider(): array
6137  {
6138  return [
6139  'Standard case' => [
6140  ' left middle right ',
6141  'middle',
6142  [
6143  'noTrimWrap' => '| left | right |',
6144  ],
6145  ],
6146  'Tabs as whitespace' => [
6147  "\t" . 'left' . "\t" . 'middle' . "\t" . 'right' . "\t",
6148  'middle',
6149  [
6150  'noTrimWrap' =>
6151  '|' . "\t" . 'left' . "\t" . '|' . "\t" . 'right' . "\t" . '|',
6152  ],
6153  ],
6154  'Split char is 0' => [
6155  ' left middle right ',
6156  'middle',
6157  [
6158  'noTrimWrap' => '0 left 0 right 0',
6159  'noTrimWrap.' => ['splitChar' => '0'],
6160  ],
6161  ],
6162  'Split char is pipe (default)' => [
6163  ' left middle right ',
6164  'middle',
6165  [
6166  'noTrimWrap' => '| left | right |',
6167  'noTrimWrap.' => ['splitChar' => '|'],
6168  ],
6169  ],
6170  'Split char is a' => [
6171  ' left middle right ',
6172  'middle',
6173  [
6174  'noTrimWrap' => 'a left a right a',
6175  'noTrimWrap.' => ['splitChar' => 'a'],
6176  ],
6177  ],
6178  'Split char is a word (ab)' => [
6179  ' left middle right ',
6180  'middle',
6181  [
6182  'noTrimWrap' => 'ab left ab right ab',
6183  'noTrimWrap.' => ['splitChar' => 'ab'],
6184  ],
6185  ],
6186  'Split char accepts stdWrap' => [
6187  ' left middle right ',
6188  'middle',
6189  [
6190  'noTrimWrap' => 'abc left abc right abc',
6191  'noTrimWrap.' => [
6192  'splitChar' => 'b',
6193  'splitChar.' => ['wrap' => 'a|c'],
6194  ],
6195  ],
6196  ],
6197  ];
6198  }
6199 
6209  public function ‪stdWrap_noTrimWrap(string $expect, string $content, array $conf): void
6210  {
6211  self::assertSame(
6212  $expect,
6213  $this->subject->stdWrap_noTrimWrap($content, $conf)
6214  );
6215  }
6216 
6228  public function ‪stdWrap_numRows(): void
6229  {
6230  $conf = [
6231  'numRows' => ‪StringUtility::getUniqueId('numRows'),
6232  'numRows.' => [‪StringUtility::getUniqueId('numRows')],
6233  ];
6234  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6235  ->onlyMethods(['numRows'])->getMock();
6236  ‪$subject->expects(self::once())->method('numRows')
6237  ->with($conf['numRows.'])->willReturn('return');
6238  self::assertSame(
6239  'return',
6240  ‪$subject->stdWrap_numRows('discard', $conf)
6241  );
6242  }
6243 
6256  public function ‪stdWrap_numberFormat(): void
6257  {
6258  $content = ‪StringUtility::getUniqueId('content');
6259  $conf = [
6260  'numberFormat' => ‪StringUtility::getUniqueId('not used'),
6261  'numberFormat.' => [‪StringUtility::getUniqueId('numberFormat.')],
6262  ];
6263  $return = ‪StringUtility::getUniqueId('return');
6264  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6265  ->onlyMethods(['numberFormat'])->getMock();
6266  ‪$subject
6267  ->expects(self::once())
6268  ->method('numberFormat')
6269  ->with((float)$content, $conf['numberFormat.'])
6270  ->willReturn($return);
6271  self::assertSame(
6272  $return,
6273  ‪$subject->stdWrap_numberFormat($content, $conf)
6274  );
6275  }
6276 
6282  public function ‪stdWrap_outerWrapDataProvider(): array
6283  {
6284  return [
6285  'no conf' => [
6286  'XXX',
6287  'XXX',
6288  [],
6289  ],
6290  'simple' => [
6291  '<wrap>XXX</wrap>',
6292  'XXX',
6293  ['outerWrap' => '<wrap>|</wrap>'],
6294  ],
6295  'missing pipe puts wrap before' => [
6296  '<pre>XXX',
6297  'XXX',
6298  ['outerWrap' => '<pre>'],
6299  ],
6300  'trims whitespace' => [
6301  '<wrap>XXX</wrap>',
6302  'XXX',
6303  ['outerWrap' => '<wrap>' . "\t" . ' | ' . "\t" . '</wrap>'],
6304  ],
6305  'split char change is not possible' => [
6306  '<wrap> # </wrap>XXX',
6307  'XXX',
6308  [
6309  'outerWrap' => '<wrap> # </wrap>',
6310  'outerWrap.' => ['splitChar' => '#'],
6311  ],
6312  ],
6313  ];
6314  }
6315 
6325  public function ‪stdWrap_outerWrap(string $expected, string $input, array $conf): void
6326  {
6327  self::assertSame(
6328  $expected,
6329  $this->subject->stdWrap_outerWrap($input, $conf)
6330  );
6331  }
6332 
6338  public function ‪stdWrap_overrideDataProvider(): array
6339  {
6340  return [
6341  'standard case' => [
6342  'override',
6343  'content',
6344  ['override' => 'override'],
6345  ],
6346  'empty conf does not override' => [
6347  'content',
6348  'content',
6349  [],
6350  ],
6351  'empty string does not override' => [
6352  'content',
6353  'content',
6354  ['override' => ''],
6355  ],
6356  'whitespace does not override' => [
6357  'content',
6358  'content',
6359  ['override' => ' ' . "\t"],
6360  ],
6361  'zero does not override' => [
6362  'content',
6363  'content',
6364  ['override' => 0],
6365  ],
6366  'false does not override' => [
6367  'content',
6368  'content',
6369  ['override' => false],
6370  ],
6371  'null does not override' => [
6372  'content',
6373  'content',
6374  ['override' => null],
6375  ],
6376  'one does override' => [
6377  1,
6378  'content',
6379  ['override' => 1],
6380  ],
6381  'minus one does override' => [
6382  -1,
6383  'content',
6384  ['override' => -1],
6385  ],
6386  'float does override' => [
6387  -0.1,
6388  'content',
6389  ['override' => -0.1],
6390  ],
6391  'true does override' => [
6392  true,
6393  'content',
6394  ['override' => true],
6395  ],
6396  'the value is not trimmed' => [
6397  "\t" . 'override',
6398  'content',
6399  ['override' => "\t" . 'override'],
6400  ],
6401  ];
6402  }
6403 
6413  public function ‪stdWrap_override($expect, string $content, array $conf): void
6414  {
6415  self::assertSame(
6416  $expect,
6417  $this->subject->stdWrap_override($content, $conf)
6418  );
6419  }
6420 
6434  public function ‪stdWrap_parseFunc(): void
6435  {
6436  $content = ‪StringUtility::getUniqueId('content');
6437  $conf = [
6438  'parseFunc' => ‪StringUtility::getUniqueId('parseFunc'),
6439  'parseFunc.' => [‪StringUtility::getUniqueId('parseFunc.')],
6440  ];
6441  $return = ‪StringUtility::getUniqueId('return');
6442  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6443  ->onlyMethods(['parseFunc'])->getMock();
6444  ‪$subject
6445  ->expects(self::once())
6446  ->method('parseFunc')
6447  ->with($content, $conf['parseFunc.'], $conf['parseFunc'])
6448  ->willReturn($return);
6449  self::assertSame(
6450  $return,
6451  ‪$subject->stdWrap_parseFunc($content, $conf)
6452  );
6453  }
6454 
6468  public function ‪stdWrap_postCObject(): void
6469  {
6470  $debugKey = '/stdWrap/.postCObject';
6471  $content = ‪StringUtility::getUniqueId('content');
6472  $conf = [
6473  'postCObject' => ‪StringUtility::getUniqueId('postCObject'),
6474  'postCObject.' => [‪StringUtility::getUniqueId('postCObject.')],
6475  ];
6476  $return = ‪StringUtility::getUniqueId('return');
6477  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6478  ->onlyMethods(['cObjGetSingle'])->getMock();
6479  ‪$subject
6480  ->expects(self::once())
6481  ->method('cObjGetSingle')
6482  ->with($conf['postCObject'], $conf['postCObject.'], $debugKey)
6483  ->willReturn($return);
6484  self::assertSame(
6485  $content . $return,
6486  ‪$subject->stdWrap_postCObject($content, $conf)
6487  );
6488  }
6489 
6501  public function ‪stdWrap_postUserFunc(): void
6502  {
6503  $content = ‪StringUtility::getUniqueId('content');
6504  $conf = [
6505  'postUserFunc' => ‪StringUtility::getUniqueId('postUserFunc'),
6506  'postUserFunc.' => [‪StringUtility::getUniqueId('postUserFunc.')],
6507  ];
6508  $return = ‪StringUtility::getUniqueId('return');
6509  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6510  ->onlyMethods(['callUserFunction'])->getMock();
6511  ‪$subject
6512  ->expects(self::once())
6513  ->method('callUserFunction')
6514  ->with($conf['postUserFunc'], $conf['postUserFunc.'])
6515  ->willReturn($return);
6516  self::assertSame(
6517  $return,
6518  ‪$subject->stdWrap_postUserFunc($content, $conf)
6519  );
6520  }
6521 
6540  public function ‪stdWrap_postUserFuncInt(): void
6541  {
6542  $uniqueHash = ‪StringUtility::getUniqueId('uniqueHash');
6543  $substKey = 'INT_SCRIPT.' . $uniqueHash;
6544  $content = ‪StringUtility::getUniqueId('content');
6545  $conf = [
6546  'postUserFuncInt' => ‪StringUtility::getUniqueId('function'),
6547  'postUserFuncInt.' => [‪StringUtility::getUniqueId('function array')],
6548  ];
6549  $expect = '<!--' . $substKey . '-->';
6550  $frontend = $this->getMockBuilder(TypoScriptFrontendController::class)
6551  ->disableOriginalConstructor()->onlyMethods(['uniqueHash'])
6552  ->getMock();
6553  $frontend->expects(self::once())->method('uniqueHash')
6554  ->with()->willReturn($uniqueHash);
6555  $frontend->config = [];
6556  ‪$subject = $this->getAccessibleMock(
6557  ContentObjectRenderer::class,
6558  null,
6559  [$frontend]
6560  );
6561  self::assertSame(
6562  $expect,
6563  ‪$subject->stdWrap_postUserFuncInt($content, $conf)
6564  );
6565  $array = [
6566  'content' => $content,
6567  'postUserFunc' => $conf['postUserFuncInt'],
6568  'conf' => $conf['postUserFuncInt.'],
6569  'type' => 'POSTUSERFUNC',
6570  'cObj' => serialize(‪$subject),
6571  ];
6572  self::assertSame(
6573  $array,
6574  $frontend->config['INTincScript'][$substKey]
6575  );
6576  }
6577 
6591  public function ‪stdWrap_preCObject(): void
6592  {
6593  $debugKey = '/stdWrap/.preCObject';
6594  $content = ‪StringUtility::getUniqueId('content');
6595  $conf = [
6596  'preCObject' => ‪StringUtility::getUniqueId('preCObject'),
6597  'preCObject.' => [‪StringUtility::getUniqueId('preCObject.')],
6598  ];
6599  $return = ‪StringUtility::getUniqueId('return');
6600  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6601  ->onlyMethods(['cObjGetSingle'])->getMock();
6602  ‪$subject
6603  ->expects(self::once())
6604  ->method('cObjGetSingle')
6605  ->with($conf['preCObject'], $conf['preCObject.'], $debugKey)
6606  ->willReturn($return);
6607  self::assertSame(
6608  $return . $content,
6609  ‪$subject->stdWrap_preCObject($content, $conf)
6610  );
6611  }
6612 
6626  public function ‪stdWrap_preIfEmptyListNum(): void
6627  {
6628  $content = ‪StringUtility::getUniqueId('content');
6629  $conf = [
6630  'preIfEmptyListNum' => ‪StringUtility::getUniqueId('preIfEmptyListNum'),
6631  'preIfEmptyListNum.' => [
6632  'splitChar' => ‪StringUtility::getUniqueId('splitChar'),
6633  ],
6634  ];
6635  $return = ‪StringUtility::getUniqueId('return');
6636  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6637  ->onlyMethods(['listNum'])->getMock();
6638  ‪$subject
6639  ->expects(self::once())
6640  ->method('listNum')
6641  ->with(
6642  $content,
6643  $conf['preIfEmptyListNum'],
6644  $conf['preIfEmptyListNum.']['splitChar']
6645  )
6646  ->willReturn($return);
6647  self::assertSame(
6648  $return,
6649  ‪$subject->stdWrap_preIfEmptyListNum($content, $conf)
6650  );
6651  }
6652 
6658  public function ‪stdWrap_prefixCommentDataProvider(): array
6659  {
6660  $content = ‪StringUtility::getUniqueId('content');
6661  $will = ‪StringUtility::getUniqueId('will');
6662  $conf = [];
6663  $conf['prefixComment'] = ‪StringUtility::getUniqueId('prefixComment');
6664  $emptyConf1 = [];
6665  $emptyConf2 = [];
6666  $emptyConf2['prefixComment'] = '';
6667  return [
6668  'standard case' => [$will, $content, $conf, false, 1, $will],
6669  'emptyConf1' => [$content, $content, $emptyConf1, false, 0, $will],
6670  'emptyConf2' => [$content, $content, $emptyConf2, false, 0, $will],
6671  'disabled by bool' => [$content, $content, $conf, true, 0, $will],
6672  'disabled by int' => [$content, $content, $conf, 1, 0, $will],
6673  ];
6674  }
6675 
6699  public function ‪stdWrap_prefixComment(
6700  string $expect,
6701  string $content,
6702  array $conf,
6703  $disable,
6704  int $times,
6705  string $will
6706  ): void {
6707  $this->frontendControllerMock
6708  ->config['config']['disablePrefixComment'] = $disable;
6709  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6710  ->onlyMethods(['prefixComment'])->getMock();
6711  ‪$subject
6712  ->expects(self::exactly($times))
6713  ->method('prefixComment')
6714  ->with($conf['prefixComment'] ?? null, [], $content)
6715  ->willReturn($will);
6716  self::assertSame(
6717  $expect,
6718  ‪$subject->stdWrap_prefixComment($content, $conf)
6719  );
6720  }
6721 
6735  public function ‪stdWrap_prepend(): void
6736  {
6737  $debugKey = '/stdWrap/.prepend';
6738  $content = ‪StringUtility::getUniqueId('content');
6739  $conf = [
6740  'prepend' => ‪StringUtility::getUniqueId('prepend'),
6741  'prepend.' => [‪StringUtility::getUniqueId('prepend.')],
6742  ];
6743  $return = ‪StringUtility::getUniqueId('return');
6744  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6745  ->onlyMethods(['cObjGetSingle'])->getMock();
6746  ‪$subject
6747  ->expects(self::once())
6748  ->method('cObjGetSingle')
6749  ->with($conf['prepend'], $conf['prepend.'], $debugKey)
6750  ->willReturn($return);
6751  self::assertSame(
6752  $return . $content,
6753  ‪$subject->stdWrap_prepend($content, $conf)
6754  );
6755  }
6756 
6762  public function ‪stdWrap_prioriCalcDataProvider(): array
6763  {
6764  return [
6765  'priority of *' => ['7', '1 + 2 * 3', []],
6766  'priority of parentheses' => ['9', '(1 + 2) * 3', []],
6767  'float' => ['1.5', '3/2', []],
6768  'intval casts to int' => [1, '3/2', ['prioriCalc' => 'intval']],
6769  'intval does not round' => [2, '2.7', ['prioriCalc' => 'intval']],
6770  ];
6771  }
6772 
6793  public function ‪stdWrap_prioriCalc($expect, string $content, array $conf): void
6794  {
6795  $result = $this->subject->stdWrap_prioriCalc($content, $conf);
6796  self::assertSame($expect, $result);
6797  }
6798 
6812  public function ‪stdWrap_preUserFunc(): void
6813  {
6814  $content = ‪StringUtility::getUniqueId('content');
6815  $conf = [
6816  'preUserFunc' => ‪StringUtility::getUniqueId('preUserFunc'),
6817  'preUserFunc.' => [‪StringUtility::getUniqueId('preUserFunc.')],
6818  ];
6819  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6820  ->onlyMethods(['callUserFunction'])->getMock();
6821  ‪$subject->expects(self::once())->method('callUserFunction')
6822  ->with($conf['preUserFunc'], $conf['preUserFunc.'], $content)
6823  ->willReturn('return');
6824  self::assertSame(
6825  'return',
6826  ‪$subject->stdWrap_preUserFunc($content, $conf)
6827  );
6828  }
6829 
6835  public function ‪stdWrap_rawUrlEncodeDataProvider(): array
6836  {
6837  return [
6838  'https://typo3.org?id=10' => [
6839  'https%3A%2F%2Ftypo3.org%3Fid%3D10',
6840  'https://typo3.org?id=10',
6841  ],
6842  'https://typo3.org?id=10&foo=bar' => [
6843  'https%3A%2F%2Ftypo3.org%3Fid%3D10%26foo%3Dbar',
6844  'https://typo3.org?id=10&foo=bar',
6845  ],
6846  ];
6847  }
6848 
6857  public function ‪stdWrap_rawUrlEncode(string $expect, string $content): void
6858  {
6859  self::assertSame(
6860  $expect,
6861  $this->subject->stdWrap_rawUrlEncode($content)
6862  );
6863  }
6864 
6877  public function ‪stdWrap_replacement(): void
6878  {
6879  $content = ‪StringUtility::getUniqueId('content');
6880  $conf = [
6881  'replacement' => ‪StringUtility::getUniqueId('not used'),
6882  'replacement.' => [‪StringUtility::getUniqueId('replacement.')],
6883  ];
6884  $return = ‪StringUtility::getUniqueId('return');
6885  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6886  ->onlyMethods(['replacement'])->getMock();
6887  ‪$subject
6888  ->expects(self::once())
6889  ->method('replacement')
6890  ->with($content, $conf['replacement.'])
6891  ->willReturn($return);
6892  self::assertSame(
6893  $return,
6894  ‪$subject->stdWrap_replacement($content, $conf)
6895  );
6896  }
6897 
6903  public function ‪stdWrap_requiredDataProvider(): array
6904  {
6905  return [
6906  // empty content
6907  'empty string is empty' => ['', true, ''],
6908  'null is empty' => ['', true, null],
6909  'false is empty' => ['', true, false],
6910 
6911  // non-empty content
6912  'blank is not empty' => [' ', false, ' '],
6913  'tab is not empty' => ["\t", false, "\t"],
6914  'linebreak is not empty' => [PHP_EOL, false, PHP_EOL],
6915  '"0" is not empty' => ['0', false, '0'],
6916  '0 is not empty' => [0, false, 0],
6917  '1 is not empty' => [1, false, 1],
6918  'true is not empty' => [true, false, true],
6919  ];
6920  }
6921 
6937  public function ‪stdWrap_required($expect, bool $stop, $content): void
6938  {
6940  ‪$subject->_set('stdWrapRecursionLevel', 1);
6941  ‪$subject->_set('stopRendering', [1 => false]);
6942  self::assertSame($expect, ‪$subject->stdWrap_required($content));
6943  self::assertSame($stop, ‪$subject->_get('stopRendering')[1]);
6944  }
6945 
6958  public function ‪stdWrap_round(): void
6959  {
6960  $content = ‪StringUtility::getUniqueId('content');
6961  $conf = [
6962  'round' => ‪StringUtility::getUniqueId('not used'),
6963  'round.' => [‪StringUtility::getUniqueId('round.')],
6964  ];
6965  $return = ‪StringUtility::getUniqueId('return');
6966  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
6967  ->onlyMethods(['round'])->getMock();
6968  ‪$subject
6969  ->expects(self::once())
6970  ->method('round')
6971  ->with($content, $conf['round.'])
6972  ->willReturn($return);
6973  self::assertSame($return, ‪$subject->stdWrap_round($content, $conf));
6974  }
6975 
6981  public function ‪stdWrap_setContentToCurrent(): void
6982  {
6983  $content = ‪StringUtility::getUniqueId('content');
6984  self::assertNotSame($content, $this->subject->getData('current'));
6985  self::assertSame(
6986  $content,
6987  $this->subject->stdWrap_setContentToCurrent($content)
6988  );
6989  self::assertSame($content, $this->subject->getData('current'));
6990  }
6991 
6997  public function ‪stdWrap_setCurrentDataProvider(): array
6998  {
6999  return [
7000  'no conf' => [
7001  'content',
7002  [],
7003  ],
7004  'empty string' => [
7005  'content',
7006  ['setCurrent' => ''],
7007  ],
7008  'non-empty string' => [
7009  'content',
7010  ['setCurrent' => 'xxx'],
7011  ],
7012  'integer null' => [
7013  'content',
7014  ['setCurrent' => 0],
7015  ],
7016  'integer not null' => [
7017  'content',
7018  ['setCurrent' => 1],
7019  ],
7020  'boolean true' => [
7021  'content',
7022  ['setCurrent' => true],
7023  ],
7024  'boolean false' => [
7025  'content',
7026  ['setCurrent' => false],
7027  ],
7028  ];
7029  }
7030 
7039  public function ‪stdWrap_setCurrent(string $input, array $conf): void
7040  {
7041  if (isset($conf['setCurrent'])) {
7042  self::assertNotSame($conf['setCurrent'], $this->subject->getData('current'));
7043  }
7044  self::assertSame($input, $this->subject->stdWrap_setCurrent($input, $conf));
7045  if (isset($conf['setCurrent'])) {
7046  self::assertSame($conf['setCurrent'], $this->subject->getData('current'));
7047  }
7048  }
7049 
7062  public function ‪stdWrap_split(): void
7063  {
7064  $content = ‪StringUtility::getUniqueId('content');
7065  $conf = [
7066  'split' => ‪StringUtility::getUniqueId('not used'),
7067  'split.' => [‪StringUtility::getUniqueId('split.')],
7068  ];
7069  $return = ‪StringUtility::getUniqueId('return');
7070  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
7071  ->onlyMethods(['splitObj'])->getMock();
7072  ‪$subject
7073  ->expects(self::once())
7074  ->method('splitObj')
7075  ->with($content, $conf['split.'])
7076  ->willReturn($return);
7077  self::assertSame(
7078  $return,
7079  ‪$subject->stdWrap_split($content, $conf)
7080  );
7081  }
7082 
7094  public function ‪stdWrap_stdWrap(): void
7095  {
7096  $content = ‪StringUtility::getUniqueId('content');
7097  $conf = [
7098  'stdWrap' => ‪StringUtility::getUniqueId('not used'),
7099  'stdWrap.' => [‪StringUtility::getUniqueId('stdWrap.')],
7100  ];
7101  $return = ‪StringUtility::getUniqueId('return');
7102  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
7103  ->onlyMethods(['stdWrap'])->getMock();
7104  ‪$subject
7105  ->expects(self::once())
7106  ->method('stdWrap')
7107  ->with($content, $conf['stdWrap.'])
7108  ->willReturn($return);
7109  self::assertSame($return, ‪$subject->stdWrap_stdWrap($content, $conf));
7110  }
7111 
7117  public function ‪stdWrap_stdWrapValueDataProvider(): array
7118  {
7119  return [
7120  'only key returns value' => [
7121  'ifNull',
7122  [
7123  'ifNull' => '1',
7124  ],
7125  '',
7126  '1',
7127  ],
7128  'array without key returns empty string' => [
7129  'ifNull',
7130  [
7131  'ifNull.' => '1',
7132  ],
7133  '',
7134  '',
7135  ],
7136  'array without key returns default' => [
7137  'ifNull',
7138  [
7139  'ifNull.' => '1',
7140  ],
7141  'default',
7142  'default',
7143  ],
7144  'non existing key returns default' => [
7145  'ifNull',
7146  [
7147  'noTrimWrap' => 'test',
7148  'noTrimWrap.' => '1',
7149  ],
7150  'default',
7151  'default',
7152  ],
7153  'default value null is returned' => [
7154  'ifNull',
7155  [],
7156  null,
7157  null,
7158  ],
7159  'existing key and array returns stdWrap' => [
7160  'test',
7161  [
7162  'test' => 'value',
7163  'test.' => ['case' => 'upper'],
7164  ],
7165  'default',
7166  'VALUE',
7167  ],
7168  'the string "0" from stdWrap will be returned' => [
7169  'test',
7170  [
7171  'test' => '',
7172  'test.' => [
7173  'wrap' => '|0',
7174  ],
7175  ],
7176  '100',
7177  '0',
7178  ],
7179  ];
7180  }
7181 
7190  public function ‪stdWrap_stdWrapValue(
7191  string $key,
7192  array $configuration,
7193  ?string $defaultValue,
7194  ?string $expected
7195  ): void {
7196  $result = $this->subject->stdWrapValue($key, $configuration, $defaultValue);
7197  self::assertSame($expected, $result);
7198  }
7199 
7205  public function ‪stdWrap_strPadDataProvider(): array
7206  {
7207  return [
7208  'pad string with default settings and length 10' => [
7209  'Alien ',
7210  'Alien',
7211  [
7212  'length' => '10',
7213  ],
7214  ],
7215  'pad string with default settings and length 10 and multibyte character' => [
7216  'Älien ',
7217  'Älien',
7218  [
7219  'length' => '10',
7220  ],
7221  ],
7222  'pad string with padWith -= and type left and length 10' => [
7223  '-=-=-Alien',
7224  'Alien',
7225  [
7226  'length' => '10',
7227  'padWith' => '-=',
7228  'type' => 'left',
7229  ],
7230  ],
7231  'pad string with padWith äö and type left and length 10 and multibyte characters' => [
7232  'äöäöäÄlien',
7233  'Älien',
7234  [
7235  'length' => '10',
7236  'padWith' => 'äö',
7237  'type' => 'left',
7238  ],
7239  ],
7240  'pad string with padWith _ and type both and length 10' => [
7241  '__Alien___',
7242  'Alien',
7243  [
7244  'length' => '10',
7245  'padWith' => '_',
7246  'type' => 'both',
7247  ],
7248  ],
7249  'pad string with padWith 0 and type both and length 10' => [
7250  '00Alien000',
7251  'Alien',
7252  [
7253  'length' => '10',
7254  'padWith' => '0',
7255  'type' => 'both',
7256  ],
7257  ],
7258  'pad string with padWith ___ and type both and length 6' => [
7259  'Alien_',
7260  'Alien',
7261  [
7262  'length' => '6',
7263  'padWith' => '___',
7264  'type' => 'both',
7265  ],
7266  ],
7267  'pad string with padWith _ and type both and length 12, using stdWrap for length' => [
7268  '___Alien____',
7269  'Alien',
7270  [
7271  'length' => '1',
7272  'length.' => [
7273  'wrap' => '|2',
7274  ],
7275  'padWith' => '_',
7276  'type' => 'both',
7277  ],
7278  ],
7279  'pad string with padWith _ and type both and length 12, using stdWrap for padWidth' => [
7280  '-_=Alien-_=-',
7281  'Alien',
7282  [
7283  'length' => '12',
7284  'padWith' => '_',
7285  'padWith.' => [
7286  'wrap' => '-|=',
7287  ],
7288  'type' => 'both',
7289  ],
7290  ],
7291  'pad string with padWith _ and type both and length 12, using stdWrap for type' => [
7292  '_______Alien',
7293  'Alien',
7294  [
7295  'length' => '12',
7296  'padWith' => '_',
7297  'type' => 'both',
7298  // make type become "left"
7299  'type.' => [
7300  'substring' => '2,1',
7301  'wrap' => 'lef|',
7302  ],
7303  ],
7304  ],
7305  ];
7306  }
7307 
7317  public function ‪stdWrap_strPad(string $expect, string $content, array $conf): void
7318  {
7319  $conf = ['strPad.' => $conf];
7320  $result = $this->subject->stdWrap_strPad($content, $conf);
7321  self::assertSame($expect, $result);
7322  }
7323 
7329  public function ‪stdWrap_strftimeDataProvider(): array
7330  {
7331  // Fictive execution time is 2012-09-01 12:00 in UTC/GMT.
7332  $now = 1346500800;
7333  return [
7334  'given timestamp' => [
7335  '01-09-2012',
7336  $now,
7337  ['strftime' => '%d-%m-%Y'],
7338  $now,
7339  ],
7340  'empty string' => [
7341  '01-09-2012',
7342  '',
7343  ['strftime' => '%d-%m-%Y'],
7344  $now,
7345  ],
7346  'testing null' => [
7347  '01-09-2012',
7348  null,
7349  ['strftime' => '%d-%m-%Y'],
7350  $now,
7351  ],
7352  ];
7353  }
7354 
7365  public function ‪stdWrap_strftime(string $expect, $content, array $conf, int $now): void
7366  {
7367  // Save current timezone and set to UTC to make the system under test
7368  // behave the same in all server timezone settings
7369  $timezoneBackup = date_default_timezone_get();
7370  date_default_timezone_set('UTC');
7371 
7372  ‪$GLOBALS['EXEC_TIME'] = $now;
7373  $result = $this->subject->stdWrap_strftime($content, $conf);
7374 
7375  // Reset timezone
7376  date_default_timezone_set($timezoneBackup);
7377 
7378  self::assertSame($expect, $result);
7379  }
7380 
7386  public function ‪stdWrap_stripHtml(): void
7387  {
7388  $content = '<html><p>Hello <span class="inline">inline tag<span>!</p><p>Hello!</p></html>';
7389  $expected = 'Hello inline tag!Hello!';
7390  self::assertSame($expected, $this->subject->stdWrap_stripHtml($content));
7391  }
7392 
7398  public function ‪stdWrap_strtotimeDataProvider(): array
7399  {
7400  return [
7401  'date from content' => [
7402  1417651200,
7403  '2014-12-04',
7404  ['strtotime' => '1'],
7405  ],
7406  'manipulation of date from content' => [
7407  1417996800,
7408  '2014-12-04',
7409  ['strtotime' => '+ 2 weekdays'],
7410  ],
7411  'date from configuration' => [
7412  1417651200,
7413  '',
7414  ['strtotime' => '2014-12-04'],
7415  ],
7416  'manipulation of date from configuration' => [
7417  1417996800,
7418  '',
7419  ['strtotime' => '2014-12-04 + 2 weekdays'],
7420  ],
7421  'empty input' => [
7422  false,
7423  '',
7424  ['strtotime' => '1'],
7425  ],
7426  'date from content and configuration' => [
7427  false,
7428  '2014-12-04',
7429  ['strtotime' => '2014-12-05'],
7430  ],
7431  ];
7432  }
7433 
7443  public function ‪stdWrap_strtotime($expect, string $content, array $conf): void
7444  {
7445  // Set exec_time to a hard timestamp
7446  ‪$GLOBALS['EXEC_TIME'] = 1417392000;
7447  // Save current timezone and set to UTC to make the system under test
7448  // behave the same in all server timezone settings
7449  $timezoneBackup = date_default_timezone_get();
7450  date_default_timezone_set('UTC');
7451 
7452  $result = $this->subject->stdWrap_strtotime($content, $conf);
7453 
7454  // Reset timezone
7455  date_default_timezone_set($timezoneBackup);
7456 
7457  self::assertEquals($expect, $result);
7458  }
7459 
7472  public function ‪stdWrap_substring(): void
7473  {
7474  $content = ‪StringUtility::getUniqueId('content');
7475  $conf = [
7476  'substring' => ‪StringUtility::getUniqueId('substring'),
7477  'substring.' => ‪StringUtility::getUniqueId('not used'),
7478  ];
7479  $return = ‪StringUtility::getUniqueId('return');
7480  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
7481  ->onlyMethods(['substring'])->getMock();
7482  ‪$subject
7483  ->expects(self::once())
7484  ->method('substring')
7485  ->with($content, $conf['substring'])
7486  ->willReturn($return);
7487  self::assertSame(
7488  $return,
7489  ‪$subject->stdWrap_substring($content, $conf)
7490  );
7491  }
7492 
7498  public function ‪stdWrap_trimDataProvider(): array
7499  {
7500  return [
7501  // string not trimmed
7502  'empty string' => ['', ''],
7503  'string without whitespace' => ['xxx', 'xxx'],
7504  'string with whitespace inside' => [
7505  'xx ' . "\t" . ' xx',
7506  'xx ' . "\t" . ' xx',
7507  ],
7508  'string with newlines inside' => [
7509  'xx ' . PHP_EOL . ' xx',
7510  'xx ' . PHP_EOL . ' xx',
7511  ],
7512  // string trimmed
7513  'blanks around' => ['xxx', ' xxx '],
7514  'tabs around' => ['xxx', "\t" . 'xxx' . "\t"],
7515  'newlines around' => ['xxx', PHP_EOL . 'xxx' . PHP_EOL],
7516  'mixed case' => ['xxx', "\t" . ' xxx ' . PHP_EOL],
7517  // non strings
7518  'null' => ['', null],
7519  'false' => ['', false],
7520  'true' => ['1', true],
7521  'zero' => ['0', 0],
7522  'one' => ['1', 1],
7523  '-1' => ['-1', -1],
7524  '0.0' => ['0', 0.0],
7525  '1.0' => ['1', 1.0],
7526  '-1.0' => ['-1', -1.0],
7527  '1.1' => ['1.1', 1.1],
7528  ];
7529  }
7530 
7551  public function ‪stdWrap_trim(string $expect, $content): void
7552  {
7553  $result = $this->subject->stdWrap_trim($content);
7554  self::assertSame($expect, $result);
7555  }
7556 
7568  public function ‪stdWrap_typolink(): void
7569  {
7570  $content = ‪StringUtility::getUniqueId('content');
7571  $conf = [
7572  'typolink' => ‪StringUtility::getUniqueId('not used'),
7573  'typolink.' => [‪StringUtility::getUniqueId('typolink.')],
7574  ];
7575  $return = ‪StringUtility::getUniqueId('return');
7576  ‪$subject = $this->getMockBuilder(ContentObjectRenderer::class)
7577  ->onlyMethods(['typolink'])->getMock();
7578  ‪$subject
7579  ->expects(self::once())
7580  ->method('typolink')
7581  ->with($content, $conf['typolink.'])
7582  ->willReturn($return);
7583  self::assertSame($return, ‪$subject->stdWrap_typolink($content, $conf));
7584  }
7585 
7591  public function ‪stdWrap_wrapDataProvider(): array
7592  {
7593  return [
7594  'no conf' => [
7595  'XXX',
7596  'XXX',
7597  [],
7598  ],
7599  'simple' => [
7600  '<wrapper>XXX</wrapper>',
7601  'XXX',
7602  ['wrap' => '<wrapper>|</wrapper>'],
7603  ],
7604  'trims whitespace' => [
7605  '<wrapper>XXX</wrapper>',
7606  'XXX',
7607  ['wrap' => '<wrapper>' . "\t" . ' | ' . "\t" . '</wrapper>'],
7608  ],
7609  'missing pipe puts wrap before' => [
7610  '<pre>XXX',
7611  'XXX',
7612  [
7613  'wrap' => '<pre>',
7614  ],
7615  ],
7616  'split char change' => [
7617  '<wrapper>XXX</wrapper>',
7618  'XXX',
7619  [
7620  'wrap' => '<wrapper> # </wrapper>',
7621  'wrap.' => ['splitChar' => '#'],
7622  ],
7623  ],
7624  'split by pattern' => [
7625  '<wrapper>XXX</wrapper>',
7626  'XXX',
7627  [
7628  'wrap' => '<wrapper> ###splitter### </wrapper>',
7629  'wrap.' => ['splitChar' => '###splitter###'],
7630  ],
7631  ],
7632  ];
7633  }
7634 
7644  public function ‪stdWrap_wrap(string $expected, string $input, array $conf): void
7645  {
7646  self::assertSame(
7647  $expected,
7648  $this->subject->stdWrap_wrap($input, $conf)
7649  );
7650  }
7651 
7657  public function ‪stdWrap_wrap2DataProvider(): array
7658  {
7659  return [
7660  'no conf' => [
7661  'XXX',
7662  'XXX',
7663  [],
7664  ],
7665  'simple' => [
7666  '<wrapper>XXX</wrapper>',
7667  'XXX',
7668  ['wrap2' => '<wrapper>|</wrapper>'],
7669  ],
7670  'trims whitespace' => [
7671  '<wrapper>XXX</wrapper>',
7672  'XXX',
7673  ['wrap2' => '<wrapper>' . "\t" . ' | ' . "\t" . '</wrapper>'],
7674  ],
7675  'missing pipe puts wrap2 before' => [
7676  '<pre>XXX',
7677  'XXX',
7678  [
7679  'wrap2' => '<pre>',
7680  ],
7681  ],
7682  'split char change' => [
7683  '<wrapper>XXX</wrapper>',
7684  'XXX',
7685  [
7686  'wrap2' => '<wrapper> # </wrapper>',
7687  'wrap2.' => ['splitChar' => '#'],
7688  ],
7689  ],
7690  'split by pattern' => [
7691  '<wrapper>XXX</wrapper>',
7692  'XXX',
7693  [
7694  'wrap2' => '<wrapper> ###splitter### </wrapper>',
7695  'wrap2.' => ['splitChar' => '###splitter###'],
7696  ],
7697  ],
7698  ];
7699  }
7700 
7710  public function ‪stdWrap_wrap2(string $expected, string $input, array $conf): void
7711  {
7712  self::assertSame($expected, $this->subject->stdWrap_wrap2($input, $conf));
7713  }
7714 
7720  public function ‪stdWrap_wrap3DataProvider(): array
7721  {
7722  return [
7723  'no conf' => [
7724  'XXX',
7725  'XXX',
7726  [],
7727  ],
7728  'simple' => [
7729  '<wrapper>XXX</wrapper>',
7730  'XXX',
7731  ['wrap3' => '<wrapper>|</wrapper>'],
7732  ],
7733  'trims whitespace' => [
7734  '<wrapper>XXX</wrapper>',
7735  'XXX',
7736  ['wrap3' => '<wrapper>' . "\t" . ' | ' . "\t" . '</wrapper>'],
7737  ],
7738  'missing pipe puts wrap3 before' => [
7739  '<pre>XXX',
7740  'XXX',
7741  [
7742  'wrap3' => '<pre>',
7743  ],
7744  ],
7745  'split char change' => [
7746  '<wrapper>XXX</wrapper>',
7747  'XXX',
7748  [
7749  'wrap3' => '<wrapper> # </wrapper>',
7750  'wrap3.' => ['splitChar' => '#'],
7751  ],
7752  ],
7753  'split by pattern' => [
7754  '<wrapper>XXX</wrapper>',
7755  'XXX',
7756  [
7757  'wrap3' => '<wrapper> ###splitter### </wrapper>',
7758  'wrap3.' => ['splitChar' => '###splitter###'],
7759  ],
7760  ],
7761  ];
7762  }
7763 
7773  public function ‪stdWrap_wrap3(string $expected, string $input, array $conf): void
7774  {
7775  self::assertSame($expected, $this->subject->stdWrap_wrap3($input, $conf));
7776  }
7777 
7783  public function ‪stdWrap_wrapAlignDataProvider(): array
7784  {
7785  $format = '<div style="text-align:%s;">%s</div>';
7786  $content = ‪StringUtility::getUniqueId('content');
7787  $wrapAlign = ‪StringUtility::getUniqueId('wrapAlign');
7788  $expect = sprintf($format, $wrapAlign, $content);
7789  return [
7790  'standard case' => [$expect, $content, $wrapAlign],
7791  'empty conf' => [$content, $content, null],
7792  'empty string' => [$content, $content, ''],
7793  'whitespaced zero string' => [$content, $content, ' 0 '],
7794  ];
7795  }
7796 
7813  public function ‪stdWrap_wrapAlign(string $expect, string $content, $wrapAlignConf): void
7814  {
7815  $conf = [];
7816  if ($wrapAlignConf !== null) {
7817  $conf['wrapAlign'] = $wrapAlignConf;
7818  }
7819  self::assertSame(
7820  $expect,
7821  $this->subject->stdWrap_wrapAlign($content, $conf)
7822  );
7823  }
7824 
7825  /***************************************************************************
7826  * End of tests of stdWrap in alphabetical order
7827  ***************************************************************************/
7828 
7829  /***************************************************************************
7830  * Begin: Mixed tests
7831  *
7832  * - Add new tests here that still don't have a better place in this class.
7833  * - Place tests in alphabetical order.
7834  * - Place data provider above test method.
7835  ***************************************************************************/
7836 
7842  public function ‪getCurrentTable(): void
7843  {
7844  self::assertEquals('tt_content', $this->subject->getCurrentTable());
7845  }
7846 
7852  public function ‪prefixCommentDataProvider(): array
7853  {
7854  $comment = ‪StringUtility::getUniqueId();
7855  $content = ‪StringUtility::getUniqueId();
7856  $format = '%s';
7857  $format .= '%%s<!-- %%s [begin] -->%s';
7858  $format .= '%%s%s%%s%s';
7859  $format .= '%%s<!-- %%s [end] -->%s';
7860  $format .= '%%s%s';
7861  $format = sprintf($format, LF, LF, "\t", LF, LF, "\t");
7862  $indent1 = "\t";
7863  $indent2 = "\t" . "\t";
7864  return [
7865  'indent one tab' => [
7866  sprintf(
7867  $format,
7868  $indent1,
7869  $comment,
7870  $indent1,
7871  $content,
7872  $indent1,
7873  $comment,
7874  $indent1
7875  ),
7876  '1|' . $comment,
7877  $content,
7878  ],
7879  'indent two tabs' => [
7880  sprintf(
7881  $format,
7882  $indent2,
7883  $comment,
7884  $indent2,
7885  $content,
7886  $indent2,
7887  $comment,
7888  $indent2
7889  ),
7890  '2|' . $comment,
7891  $content,
7892  ],
7893  'htmlspecialchars applies for comment only' => [
7894  sprintf(
7895  $format,
7896  $indent1,
7897  '&lt;' . $comment . '&gt;',
7898  $indent1,
7899  '<' . $content . '>',
7900  $indent1,
7901  '&lt;' . $comment . '&gt;',
7902  $indent1
7903  ),
7904  '1|<' . $comment . '>',
7905  '<' . $content . '>',
7906  ],
7907  ];
7908  }
7909 
7919  public function ‪prefixComment(string $expect, string $comment, string $content): void
7920  {
7921  // The parameter $conf is never used. Just provide null.
7922  // Consider to improve the signature and deprecate the old one.
7923  $result = $this->subject->prefixComment($comment, null, $content);
7924  self::assertEquals($expect, $result);
7925  }
7926 
7932  public function ‪setCurrentFile_getCurrentFile(): void
7933  {
7934  $storageMock = $this->createMock(ResourceStorage::class);
7935  $file = new File(['testfile'], $storageMock);
7936  $this->subject->setCurrentFile($file);
7937  self::assertSame($file, $this->subject->getCurrentFile());
7938  }
7939 
7949  public function ‪setCurrentVal_getCurrentVal(): void
7950  {
7952  $value = ‪StringUtility::getUniqueId();
7953  $this->subject->currentValKey = $key;
7954  $this->subject->setCurrentVal($value);
7955  self::assertEquals($value, $this->subject->getCurrentVal());
7956  self::assertEquals($value, $this->subject->data[$key]);
7957  }
7958 
7964  public function ‪setUserObjectType_getUserObjectType(): void
7965  {
7966  $value = ‪StringUtility::getUniqueId();
7967  $this->subject->setUserObjectType($value);
7968  self::assertEquals($value, $this->subject->getUserObjectType());
7969  }
7970 
7976  public function ‪emailSpamProtectionWithTypeAsciiDataProvider(): array
7977  {
7978  return [
7979  'Simple email address' => [
7980  'test@email.tld',
7981  '&#116;&#101;&#115;&#116;&#64;&#101;&#109;&#97;&#105;&#108;&#46;&#116;&#108;&#100;',
7982  ],
7983  'Simple email address with unicode characters' => [
7984  'matthäus@email.tld',
7985  '&#109;&#97;&#116;&#116;&#104;&#228;&#117;&#115;&#64;&#101;&#109;&#97;&#105;&#108;&#46;&#116;&#108;&#100;',
7986  ],
7987  'Susceptible email address' => [
7988  '"><script>alert(\'emailSpamProtection\')</script>',
7989  '&#34;&#62;&#60;&#115;&#99;&#114;&#105;&#112;&#116;&#62;&#97;&#108;&#101;&#114;&#116;&#40;&#39;&#101;&#109;&#97;&#105;&#108;&#83;&#112;&#97;&#109;&#80;&#114;&#111;&#116;&#101;&#99;&#116;&#105;&#111;&#110;&#39;&#41;&#60;&#47;&#115;&#99;&#114;&#105;&#112;&#116;&#62;',
7990 
7991  ],
7992  'Susceptible email address with unicode characters' => [
7993  '"><script>alert(\'È…mÇ¡ilSpamProtÈ…ction\')</script>',
7994  '&#34;&#62;&#60;&#115;&#99;&#114;&#105;&#112;&#116;&#62;&#97;&#108;&#101;&#114;&#116;&#40;&#39;&#517;&#109;&#481;&#105;&#108;&#83;&#112;&#97;&#109;&#80;&#114;&#111;&#116;&#517;&#99;&#116;&#105;&#111;&#110;&#39;&#41;&#60;&#47;&#115;&#99;&#114;&#105;&#112;&#116;&#62;',
7995  ],
7996  ];
7997  }
7998 
8007  public function ‪mailSpamProtectionWithTypeAscii(string $content, string $expected): void
8008  {
8009  self::assertSame(
8010  $expected,
8011  $this->subject->_call('encryptEmail', $content, 'ascii')
8012  );
8013  }
8014 
8015  public function ‪getGlobalDataProvider(): array
8016  {
8017  return [
8018  'simple' => [
8019  'foo',
8020  'HTTP_SERVER_VARS | something',
8021  [
8022  'HTTP_SERVER_VARS' => [
8023  'something' => 'foo',
8024  ],
8025  ],
8026  null,
8027  ],
8028  'simple source fallback' => [
8029  'foo',
8030  'HTTP_SERVER_VARS | something',
8031  null,
8032  [
8033  'HTTP_SERVER_VARS' => [
8034  'something' => 'foo',
8035  ],
8036  ],
8037  ],
8038  'globals ignored if source given' => [
8039  '',
8040  'HTTP_SERVER_VARS | something',
8041  [
8042  'HTTP_SERVER_VARS' => [
8043  'something' => 'foo',
8044  ],
8045  ],
8046  [
8047  'HTTP_SERVER_VARS' => [
8048  'something-else' => 'foo',
8049  ],
8050  ],
8051  ],
8052  'sub array is returned as empty string' => [
8053  '',
8054  'HTTP_SERVER_VARS | something',
8055  [
8056  'HTTP_SERVER_VARS' => [
8057  'something' => ['foo'],
8058  ],
8059  ],
8060  null,
8061  ],
8062  'does not exist' => [
8063  '',
8064  'HTTP_SERVER_VARS | something',
8065  [
8066  'HTTP_SERVER_VARS' => [
8067  'something-else' => 'foo',
8068  ],
8069  ],
8070  null,
8071  ],
8072  'does not exist in source' => [
8073  '',
8074  'HTTP_SERVER_VARS | something',
8075  null,
8076  [
8077  'HTTP_SERVER_VARS' => [
8078  'something-else' => 'foo',
8079  ],
8080  ],
8081  ],
8082  ];
8083  }
8084 
8093  public function ‪getGlobalReturnsExpectedResult($expected, string $key, ?array $globals, ?array $source): void
8094  {
8095  if (isset($globals['HTTP_SERVER_VARS'])) {
8096  // Note we can't simply $GLOBALS = $globals, since phpunit backupGlobals works on existing array keys.
8097  ‪$GLOBALS['HTTP_SERVER_VARS'] = $globals['HTTP_SERVER_VARS'];
8098  }
8099  self::assertSame(
8100  $expected,
8101  (new ContentObjectRenderer())->getGlobal($key, $source)
8102  );
8103  }
8104 
8105  /***************************************************************************
8106  * End: Mixed tests
8107  ***************************************************************************/
8108 }
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\canRegisterAContentObjectClassForATypoScriptName
‪canRegisterAContentObjectClassForATypoScriptName()
Definition: ContentObjectRendererTest.php:288
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_prepend
‪stdWrap_prepend()
Definition: ContentObjectRendererTest.php:6732
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\mailSpamProtectionWithTypeAscii
‪mailSpamProtectionWithTypeAscii(string $content, string $expected)
Definition: ContentObjectRendererTest.php:8004
‪TYPO3\CMS\Frontend\ContentObject\RestoreRegisterContentObject
Definition: RestoreRegisterContentObject.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkLinkResult
‪typolinkLinkResult()
Definition: ContentObjectRendererTest.php:3006
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_setContentToCurrent
‪stdWrap_setContentToCurrent()
Definition: ContentObjectRendererTest.php:6978
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_rawUrlEncodeDataProvider
‪array stdWrap_rawUrlEncodeDataProvider()
Definition: ContentObjectRendererTest.php:6832
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectStdWrapHookInterface
Definition: ContentObjectStdWrapHookInterface.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\round
‪round(float $expect, $content, array $conf)
Definition: ContentObjectRendererTest.php:841
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_encapsLines
‪stdWrap_encapsLines()
Definition: ContentObjectRendererTest.php:4955
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_preIfEmptyListNum
‪stdWrap_preIfEmptyListNum()
Definition: ContentObjectRendererTest.php:6623
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\roundDataProvider
‪array roundDataProvider()
Definition: ContentObjectRendererTest.php:776
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_strftime
‪stdWrap_strftime(string $expect, $content, array $conf, int $now)
Definition: ContentObjectRendererTest.php:7362
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_innerWrap2DataProvider
‪array stdWrap_innerWrap2DataProvider()
Definition: ContentObjectRendererTest.php:5787
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkReturnsCorrectLinksForEmailsAndUrls
‪typolinkReturnsCorrectLinksForEmailsAndUrls(string $linkText, array $configuration, string $expectedResult)
Definition: ContentObjectRendererTest.php:2457
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\mailtoMakelinksReturnsMailToLink
‪mailtoMakelinksReturnsMailToLink(string $data, array $configuration, string $expectedResult)
Definition: ContentObjectRendererTest.php:2279
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeSiteLanguage
‪getDataWithTypeSiteLanguage()
Definition: ContentObjectRendererTest.php:1708
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_strtotime
‪stdWrap_strtotime($expect, string $content, array $conf)
Definition: ContentObjectRendererTest.php:7440
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapBrDataProvider
‪string[][] stdWrapBrDataProvider()
Definition: ContentObjectRendererTest.php:3895
‪TYPO3\CMS\Core\Context\WorkspaceAspect
Definition: WorkspaceAspect.php:31
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_round
‪stdWrap_round()
Definition: ContentObjectRendererTest.php:6955
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\$subject
‪MockObject $subject
Definition: ContentObjectRendererTest.php:98
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\$contentObjectMap
‪array $contentObjectMap
Definition: ContentObjectRendererTest.php:114
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getQueryArgumentsExcludesParameters
‪getQueryArgumentsExcludesParameters()
Definition: ContentObjectRendererTest.php:401
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static string getPublicPath()
Definition: Environment.php:206
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeTsfe
‪getDataWithTypeTsfe()
Definition: ContentObjectRendererTest.php:1251
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeGlobal
‪getDataWithTypeGlobal()
Definition: ContentObjectRendererTest.php:1410
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\emailSpamProtectionWithTypeAsciiDataProvider
‪array emailSpamProtectionWithTypeAsciiDataProvider()
Definition: ContentObjectRendererTest.php:7973
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_HTMLparserDataProvider
‪array stdWrap_HTMLparserDataProvider()
Definition: ContentObjectRendererTest.php:3711
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_split
‪stdWrap_split()
Definition: ContentObjectRendererTest.php:7059
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\$templateServiceMock
‪MockObject TemplateService $templateServiceMock
Definition: ContentObjectRendererTest.php:107
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkReturnsCorrectLinksFilesDataProvider
‪array typolinkReturnsCorrectLinksFilesDataProvider()
Definition: ContentObjectRendererTest.php:2635
‪TYPO3\CMS\Core\Core\ApplicationContext
Definition: ApplicationContext.php:39
‪TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor
Definition: ContentDataProcessor.php:26
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\canNotAccessInternalContentObjectMapByReference
‪canNotAccessInternalContentObjectMapByReference()
Definition: ContentObjectRendererTest.php:325
‪TYPO3\CMS\Frontend\ContentObject\ImageContentObject
Definition: ImageContentObject.php:28
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrap3DataProvider
‪array stdWrap_wrap3DataProvider()
Definition: ContentObjectRendererTest.php:7717
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDebugRootline
‪getDataWithTypeDebugRootline()
Definition: ContentObjectRendererTest.php:1739
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_replacement
‪stdWrap_replacement()
Definition: ContentObjectRendererTest.php:6874
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDate
‪getDataWithTypeDate()
Definition: ContentObjectRendererTest.php:1516
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_cObject
‪stdWrap_cObject()
Definition: ContentObjectRendererTest.php:4086
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_cacheReadDataProvider
‪array stdWrap_cacheReadDataProvider()
Definition: ContentObjectRendererTest.php:4192
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeGp
‪getDataWithTypeGp(string $key, string $expectedValue)
Definition: ContentObjectRendererTest.php:1233
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapReturnsExpectationDataProvider
‪array stdWrapReturnsExpectationDataProvider()
Definition: ContentObjectRendererTest.php:1103
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\localConfigurationOverridesGlobalConfiguration
‪localConfigurationOverridesGlobalConfiguration()
Definition: ContentObjectRendererTest.php:1957
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\httpMakelinksReturnsLink
‪httpMakelinksReturnsLink(string $data, array $configuration, string $expectedResult)
Definition: ContentObjectRendererTest.php:2179
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTestTrait
Definition: ContentObjectRendererTestTrait.php:26
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_addPageCacheTagsAddsPageTagsDataProvider
‪array stdWrap_addPageCacheTagsAddsPageTagsDataProvider()
Definition: ContentObjectRendererTest.php:3792
‪TYPO3\CMS\Frontend\ContentObject\HierarchicalMenuContentObject
Definition: HierarchicalMenuContentObject.php:26
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\$resetSingletonInstances
‪bool $resetSingletonInstances
Definition: ContentObjectRendererTest.php:93
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeCurrent
‪getDataWithTypeCurrent()
Definition: ContentObjectRendererTest.php:1542
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typoLinkEncodesMailAddressForSpamProtection
‪typoLinkEncodesMailAddressForSpamProtection(array $settings, string $linkText, string $mailAddress, string $expected)
Definition: ContentObjectRendererTest.php:2499
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_required
‪stdWrap_required($expect, bool $stop, $content)
Definition: ContentObjectRendererTest.php:6934
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_cacheStoreDataProvider
‪array stdWrap_cacheStoreDataProvider()
Definition: ContentObjectRendererTest.php:4276
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\hashDataProvider
‪array hashDataProvider()
Definition: ContentObjectRendererTest.php:5335
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_innerWrap2
‪stdWrap_innerWrap2(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:5830
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrap2DataProvider
‪array stdWrap_wrap2DataProvider()
Definition: ContentObjectRendererTest.php:7654
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDbReturnsCorrectTitle
‪getDataWithTypeDbReturnsCorrectTitle()
Definition: ContentObjectRendererTest.php:1554
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_stdWrapValueDataProvider
‪array stdWrap_stdWrapValueDataProvider()
Definition: ContentObjectRendererTest.php:7114
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeRegister
‪getDataWithTypeRegister()
Definition: ContentObjectRendererTest.php:1359
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\canSetTheContentObjectClassMapAndGetARegisteredContentObject
‪canSetTheContentObjectClassMapAndGetARegisteredContentObject()
Definition: ContentObjectRendererTest.php:307
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_dataWrap
‪stdWrap_dataWrap()
Definition: ContentObjectRendererTest.php:4671
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeParentRecordNumber
‪getDataWithTypeParentRecordNumber()
Definition: ContentObjectRendererTest.php:1727
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_brTag
‪stdWrap_brTag(string $input, string $expected, array $config)
Definition: ContentObjectRendererTest.php:3981
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\renderedErrorMessageCanBeCustomized
‪renderedErrorMessageCanBeCustomized()
Definition: ContentObjectRendererTest.php:1940
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\isGetImgResourceHookCalledCallback
‪isGetImgResourceHookCalledCallback(string $file, array $fileArray, array $imageResource, ContentObjectRenderer $parent)
Definition: ContentObjectRendererTest.php:258
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_insertData
‪stdWrap_insertData()
Definition: ContentObjectRendererTest.php:5849
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\html5SelfClosingTagsDataprovider
‪array html5SelfClosingTagsDataprovider()
Definition: ContentObjectRendererTest.php:5013
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\checkIf
‪checkIf(bool $expect, array $conf)
Definition: ContentObjectRendererTest.php:5576
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeGetindpenv
‪getDataWithTypeGetindpenv()
Definition: ContentObjectRendererTest.php:1274
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_trim
‪stdWrap_trim(string $expect, $content)
Definition: ContentObjectRendererTest.php:7548
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static bool isWindows()
Definition: Environment.php:318
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\willReturnNullForUnregisteredObject
‪willReturnNullForUnregisteredObject()
Definition: ContentObjectRendererTest.php:340
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\replacementDataProvider
‪array replacementDataProvider()
Definition: ContentObjectRendererTest.php:961
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapDoubleBrTagDataProvider
‪array stdWrapDoubleBrTagDataProvider()
Definition: ContentObjectRendererTest.php:4873
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_debugData
‪stdWrap_debugData()
Definition: ContentObjectRendererTest.php:4790
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDbDataProvider
‪getDataWithTypeDbDataProvider()
Definition: ContentObjectRendererTest.php:1561
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\rawUrlEncodeSquareBracketsInUrl
‪string rawUrlEncodeSquareBracketsInUrl(string $string)
Definition: ContentObjectRendererTest.php:431
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_langViaSiteLanguage
‪stdWrap_langViaSiteLanguage(string $expected, string $input, array $conf, string $language)
Definition: ContentObjectRendererTest.php:6073
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectGetImageResourceHookInterface
Definition: ContentObjectGetImageResourceHookInterface.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getFrontendController
‪TypoScriptFrontendController getFrontendController()
Definition: ContentObjectRendererTest.php:205
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_parseFunc
‪stdWrap_parseFunc()
Definition: ContentObjectRendererTest.php:6431
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\registersAllDefaultContentObjects
‪registersAllDefaultContentObjects(string $objectName, string $className)
Definition: ContentObjectRendererTest.php:381
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_htmlSpecialCharsDataProvider
‪array stdWrap_htmlSpecialCharsDataProvider()
Definition: ContentObjectRendererTest.php:5392
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_HTMLparser
‪stdWrap_HTMLparser(string $expect, string $content, array $conf, int $times, string $will)
Definition: ContentObjectRendererTest.php:3769
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_expandList
‪stdWrap_expandList(string $expected, string $content)
Definition: ContentObjectRendererTest.php:5177
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_encapsLines_HTML5SelfClosingTags
‪stdWrap_encapsLines_HTML5SelfClosingTags(string $input, string $expected)
Definition: ContentObjectRendererTest.php:4986
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeFileReturnsUidOfFileObject
‪getDataWithTypeFileReturnsUidOfFileObject(string $typoScriptPath)
Definition: ContentObjectRendererTest.php:1331
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\cropHTMLDataProvider
‪array cropHTMLDataProvider()
Definition: ContentObjectRendererTest.php:460
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_hash
‪stdWrap_hash(string $expect, string $content, array $conf)
Definition: ContentObjectRendererTest.php:5379
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeLevelfield
‪getDataWithTypeLevelfield()
Definition: ContentObjectRendererTest.php:1477
‪TYPO3\CMS\Core\Cache\Frontend\NullFrontend
Definition: NullFrontend.php:29
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeSession
‪getDataWithTypeSession()
Definition: ContentObjectRendererTest.php:1373
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_trimDataProvider
‪array stdWrap_trimDataProvider()
Definition: ContentObjectRendererTest.php:7495
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\handleCharset
‪handleCharset(string &$subject, string &$expected)
Definition: ContentObjectRendererTest.php:216
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_substring
‪stdWrap_substring()
Definition: ContentObjectRendererTest.php:7469
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_intvalDataProvider
‪array stdWrap_intvalDataProvider()
Definition: ContentObjectRendererTest.php:5895
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDbReturnsEmptyStringOnInvalidIdentifiers
‪getDataWithTypeDbReturnsEmptyStringOnInvalidIdentifiers(string $identifier, InvocationOrder $expectsMethodCall)
Definition: ContentObjectRendererTest.php:1601
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_keywords
‪stdWrap_keywords(string $expected, string $input)
Definition: ContentObjectRendererTest.php:5997
‪TYPO3\CMS\Frontend\ContentObject\Exception\ContentRenderingException
Definition: ContentRenderingException.php:24
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeField
‪getDataWithTypeField()
Definition: ContentObjectRendererTest.php:1286
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrapAlignDataProvider
‪array stdWrap_wrapAlignDataProvider()
Definition: ContentObjectRendererTest.php:7780
‪$fields
‪$fields
Definition: pages.php:5
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getLibParseFunc
‪array getLibParseFunc()
Definition: ContentObjectRendererTest.php:2018
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:53
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_encodeForJavaScriptValue
‪stdWrap_encodeForJavaScriptValue(string $expect, string $content)
Definition: ContentObjectRendererTest.php:5142
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_rawUrlEncode
‪stdWrap_rawUrlEncode(string $expect, string $content)
Definition: ContentObjectRendererTest.php:6854
‪TYPO3\CMS\Core\Configuration\SiteConfiguration
Definition: SiteConfiguration.php:43
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\cropIsMultibyteSafe
‪cropIsMultibyteSafe()
Definition: ContentObjectRendererTest.php:442
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_field
‪stdWrap_field()
Definition: ContentObjectRendererTest.php:5195
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typoLinkEncodesMailAddressForSpamProtectionDataProvider
‪array typoLinkEncodesMailAddressForSpamProtectionDataProvider()
Definition: ContentObjectRendererTest.php:2515
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getFieldValDataProvider
‪array getFieldValDataProvider()
Definition: ContentObjectRendererTest.php:3343
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\renderingContentObjectDoesNotThrowExceptionIfExceptionHandlerIsConfiguredGlobally
‪renderingContentObjectDoesNotThrowExceptionIfExceptionHandlerIsConfiguredGlobally()
Definition: ContentObjectRendererTest.php:1914
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_doubleBrTag
‪stdWrap_doubleBrTag(string $expected, string $input, array $config)
Definition: ContentObjectRendererTest.php:4938
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\allStdWrapProcessorsAreCallable
‪allStdWrapProcessorsAreCallable()
Definition: ContentObjectRendererTest.php:3560
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\HTMLcaseshiftDataProvider
‪array HTMLcaseshiftDataProvider()
Definition: ContentObjectRendererTest.php:3469
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\calculateCacheKey
‪calculateCacheKey(string $expect, array $conf, int $times, ?string $with, ?array $withWrap, ?string $will)
Definition: ContentObjectRendererTest.php:3256
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_br
‪stdWrap_br(string $expected, string $input, ?string $xhtmlDoctype)
Definition: ContentObjectRendererTest.php:3930
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypePage
‪getDataWithTypePage()
Definition: ContentObjectRendererTest.php:1530
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_outerWrapDataProvider
‪array stdWrap_outerWrapDataProvider()
Definition: ContentObjectRendererTest.php:6279
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapKeywordsDataProvider
‪string[][] stdWrapKeywordsDataProvider()
Definition: ContentObjectRendererTest.php:5949
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_prefixComment
‪stdWrap_prefixComment(string $expect, string $content, array $conf, $disable, int $times, string $will)
Definition: ContentObjectRendererTest.php:6696
‪TYPO3\CMS\Frontend\ContentObject\UserInternalContentObject
Definition: UserInternalContentObject.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_override
‪stdWrap_override($expect, string $content, array $conf)
Definition: ContentObjectRendererTest.php:6410
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\setUp
‪setUp()
Definition: ContentObjectRendererTest.php:143
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_preCObject
‪stdWrap_preCObject()
Definition: ContentObjectRendererTest.php:6588
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:42
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_postCObject
‪stdWrap_postCObject()
Definition: ContentObjectRendererTest.php:6465
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeLeveltitle
‪getDataWithTypeLeveltitle()
Definition: ContentObjectRendererTest.php:1420
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeFileReturnsUidOfFileObjectDataProvider
‪getDataWithTypeFileReturnsUidOfFileObjectDataProvider()
Definition: ContentObjectRendererTest.php:1310
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getGlobalReturnsExpectedResult
‪getGlobalReturnsExpectedResult($expected, string $key, ?array $globals, ?array $source)
Definition: ContentObjectRendererTest.php:8090
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typoLinkLogsErrorIfNoLinkResolvingIsPossible
‪typoLinkLogsErrorIfNoLinkResolvingIsPossible()
Definition: ContentObjectRendererTest.php:2991
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_fieldRequiredDataProvider
‪array stdWrap_fieldRequiredDataProvider()
Definition: ContentObjectRendererTest.php:5217
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\substring
‪substring(string $expect, string $content, string $conf)
Definition: ContentObjectRendererTest.php:1204
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_noTrimWrap
‪stdWrap_noTrimWrap(string $expect, string $content, array $conf)
Definition: ContentObjectRendererTest.php:6206
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\prefixCommentDataProvider
‪array prefixCommentDataProvider()
Definition: ContentObjectRendererTest.php:7849
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\cropHTML
‪cropHTML(string $expect, string $content, string $conf)
Definition: ContentObjectRendererTest.php:762
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\numberFormat
‪numberFormat(string $expects, $content, array $conf)
Definition: ContentObjectRendererTest.php:948
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeSiteWithBaseVariants
‪getDataWithTypeSiteWithBaseVariants()
Definition: ContentObjectRendererTest.php:1675
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_strtotimeDataProvider
‪array stdWrap_strtotimeDataProvider()
Definition: ContentObjectRendererTest.php:7395
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeContext
‪getDataWithTypeContext()
Definition: ContentObjectRendererTest.php:1637
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeLeveluid
‪getDataWithTypeLeveluid()
Definition: ContentObjectRendererTest.php:1458
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\numberFormatDataProvider
‪array numberFormatDataProvider()
Definition: ContentObjectRendererTest.php:901
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_setCurrentDataProvider
‪array stdWrap_setCurrentDataProvider()
Definition: ContentObjectRendererTest.php:6994
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\caseshiftDataProvider
‪array caseshiftDataProvider()
Definition: ContentObjectRendererTest.php:3434
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\specificExceptionsCanBeIgnoredByExceptionHandler
‪specificExceptionsCanBeIgnoredByExceptionHandler()
Definition: ContentObjectRendererTest.php:1978
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_strPadDataProvider
‪array stdWrap_strPadDataProvider()
Definition: ContentObjectRendererTest.php:7202
‪TYPO3\CMS\Core\Core\Environment\getProjectPath
‪static string getProjectPath()
Definition: Environment.php:177
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_bytes
‪stdWrap_bytes(string $expect, string $content, array $conf)
Definition: ContentObjectRendererTest.php:4058
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_numRows
‪stdWrap_numRows()
Definition: ContentObjectRendererTest.php:6225
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\registersAllDefaultContentObjectsDataProvider
‪string[][] registersAllDefaultContentObjectsDataProvider()
Definition: ContentObjectRendererTest.php:363
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_setCurrent
‪stdWrap_setCurrent(string $input, array $conf)
Definition: ContentObjectRendererTest.php:7036
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDebugPage
‪getDataWithTypeDebugPage()
Definition: ContentObjectRendererTest.php:1823
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeGpDataProvider
‪array getDataWithTypeGpDataProvider()
Definition: ContentObjectRendererTest.php:1216
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeLll
‪getDataWithTypeLll()
Definition: ContentObjectRendererTest.php:1613
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\calculateCacheKeyDataProvider
‪array calculateCacheKeyDataProvider()
Definition: ContentObjectRendererTest.php:3196
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkReturnsCorrectLinksForFilesWithAbsRefPrefix
‪typolinkReturnsCorrectLinksForFilesWithAbsRefPrefix(string $linkText, array $configuration, string $absRefPrefix, string $expectedResult)
Definition: ContentObjectRendererTest.php:2903
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getFromCacheDataProvider
‪array getFromCacheDataProvider()
Definition: ContentObjectRendererTest.php:3273
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_ifNull
‪stdWrap_ifNull($expect, $content, array $conf)
Definition: ContentObjectRendererTest.php:5720
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_stripHtml
‪stdWrap_stripHtml()
Definition: ContentObjectRendererTest.php:7383
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeGetenv
‪getDataWithTypeGetenv()
Definition: ContentObjectRendererTest.php:1261
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_ifEmpty
‪stdWrap_ifEmpty($expect, $content, array $conf)
Definition: ContentObjectRendererTest.php:5679
‪TYPO3\CMS\Frontend\ContentObject\ScalableVectorGraphicsContentObject
Definition: ScalableVectorGraphicsContentObject.php:25
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_requiredDataProvider
‪array stdWrap_requiredDataProvider()
Definition: ContentObjectRendererTest.php:6900
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getGlobalDataProvider
‪getGlobalDataProvider()
Definition: ContentObjectRendererTest.php:8012
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_ifBlank
‪stdWrap_ifBlank($expect, $content, array $conf)
Definition: ContentObjectRendererTest.php:5625
‪TYPO3\CMS\Frontend\ContentObject\LoadRegisterContentObject
Definition: LoadRegisterContentObject.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_innerWrap
‪stdWrap_innerWrap(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:5774
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapDoesOnlyCallIfEmptyIfTheTrimmedContentIsEmptyOrZeroDataProvider
‪stdWrapDoesOnlyCallIfEmptyIfTheTrimmedContentIsEmptyOrZeroDataProvider()
Definition: ContentObjectRendererTest.php:1130
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_langDataProvider
‪array stdWrap_langDataProvider()
Definition: ContentObjectRendererTest.php:6007
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDebugFullRootline
‪getDataWithTypeDebugFullRootline()
Definition: ContentObjectRendererTest.php:1761
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_preUserFunc
‪stdWrap_preUserFunc()
Definition: ContentObjectRendererTest.php:6809
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_if
‪stdWrap_if(string $expect, bool $stop, string $content, array $conf, int $times, ?bool $will)
Definition: ContentObjectRendererTest.php:5534
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkReturnsCorrectLinksForEmailsAndUrlsDataProvider
‪array typolinkReturnsCorrectLinksForEmailsAndUrlsDataProvider()
Definition: ContentObjectRendererTest.php:2295
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typoLinkProperlyEncodesLinkResultDataProvider
‪array typoLinkProperlyEncodesLinkResultDataProvider()
Definition: ContentObjectRendererTest.php:3105
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_cacheRead
‪stdWrap_cacheRead(string $expect, string $input, array $conf, int $times, ?array $with, $will)
Definition: ContentObjectRendererTest.php:4248
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:41
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject
Definition: CaseContentObjectTest.php:18
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_innerWrapDataProvider
‪array stdWrap_innerWrapDataProvider()
Definition: ContentObjectRendererTest.php:5731
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypePath
‪getDataWithTypePath()
Definition: ContentObjectRendererTest.php:1626
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_postUserFuncInt
‪stdWrap_postUserFuncInt()
Definition: ContentObjectRendererTest.php:6537
‪TYPO3\CMS\Core\Resource\File
Definition: File.php:24
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_postUserFunc
‪stdWrap_postUserFunc()
Definition: ContentObjectRendererTest.php:6498
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\substringDataProvider
‪array substringDataProvider()
Definition: ContentObjectRendererTest.php:1176
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeSite
‪getDataWithTypeSite()
Definition: ContentObjectRendererTest.php:1655
‪TYPO3\CMS\Frontend\ContentObject\UserContentObject
Definition: UserContentObject.php:26
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\notAllStdWrapProcessorsAreCallableWithEmptyConfiguration
‪notAllStdWrapProcessorsAreCallableWithEmptyConfiguration()
Definition: ContentObjectRendererTest.php:3599
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\createContentObjectThrowingExceptionFixture
‪MockObject AbstractContentObject createContentObjectThrowingExceptionFixture(bool $addProductionExceptionHandlerInstance=true)
Definition: ContentObjectRendererTest.php:1996
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_intval
‪stdWrap_intval(int $expect, $content)
Definition: ContentObjectRendererTest.php:5939
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_prefixCommentDataProvider
‪array stdWrap_prefixCommentDataProvider()
Definition: ContentObjectRendererTest.php:6655
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\$backupEnvironment
‪$backupEnvironment
Definition: ContentObjectRendererTest.php:138
‪TYPO3\CMS\Core\Cache\CacheManager
Definition: CacheManager.php:36
‪TYPO3\CMS\Core\Service\DependencyOrderingService
Definition: DependencyOrderingService.php:32
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\renderingContentObjectDoesNotThrowExceptionIfExceptionHandlerIsConfiguredLocally
‪renderingContentObjectDoesNotThrowExceptionIfExceptionHandlerIsConfiguredLocally()
Definition: ContentObjectRendererTest.php:1901
‪TYPO3\CMS\Core\Core\Environment\initialize
‪static initialize(ApplicationContext $context, bool $cli, bool $composerMode, string $projectPath, string $publicPath, string $varPath, string $configPath, string $currentScript, string $os)
Definition: Environment.php:111
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeLevel
‪getDataWithTypeLevel()
Definition: ContentObjectRendererTest.php:1393
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_ifEmptyDataProvider
‪array stdWrap_ifEmptyDataProvider()
Definition: ContentObjectRendererTest.php:5636
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_strftimeDataProvider
‪array stdWrap_strftimeDataProvider()
Definition: ContentObjectRendererTest.php:7326
‪TYPO3\CMS\Core\Core\Environment\getBackendPath
‪static string getBackendPath()
Definition: Environment.php:276
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_noTrimWrapDataProvider
‪array stdWrap_noTrimWrapDataProvider()
Definition: ContentObjectRendererTest.php:6133
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_crop
‪stdWrap_crop()
Definition: ContentObjectRendererTest.php:4457
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\globalExceptionHandlerConfigurationCanBeOverriddenByLocalConfiguration
‪globalExceptionHandlerConfigurationCanBeOverriddenByLocalConfiguration()
Definition: ContentObjectRendererTest.php:1925
‪TYPO3\CMS\Frontend\ContentObject\ImageResourceContentObject
Definition: ImageResourceContentObject.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_encodeForJavaScriptValueDataProvider
‪array[] stdWrap_encodeForJavaScriptValueDataProvider()
Definition: ContentObjectRendererTest.php:5100
‪TYPO3\CMS\Frontend\ContentObject\AbstractContentObject
Definition: AbstractContentObject.php:29
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest
Definition: ContentObjectRendererTest.php:88
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\calcAge
‪calcAge(string $expect, int $timestamp, string $labels)
Definition: ContentObjectRendererTest.php:1092
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_cacheStore
‪stdWrap_cacheStore(?array $confCache, int $timesCCK, $key, int $times)
Definition: ContentObjectRendererTest.php:4323
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_prioriCalcDataProvider
‪array stdWrap_prioriCalcDataProvider()
Definition: ContentObjectRendererTest.php:6759
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_char
‪stdWrap_char()
Definition: ContentObjectRendererTest.php:4438
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_debugFunc
‪stdWrap_debugFunc(bool $expectArray, $confDebugFunc)
Definition: ContentObjectRendererTest.php:4851
‪TYPO3\CMS\Core\Utility\DebugUtility
Definition: DebugUtility.php:27
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDebugRegister
‪getDataWithTypeDebugRegister()
Definition: ContentObjectRendererTest.php:1803
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_strPad
‪stdWrap_strPad(string $expect, string $content, array $conf)
Definition: ContentObjectRendererTest.php:7314
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\replacement
‪replacement(string $expects, string $content, array $conf)
Definition: ContentObjectRendererTest.php:1019
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typoLinkProperlyEncodesLinkResult
‪typoLinkProperlyEncodesLinkResult(string $linkText, array $configuration, string $expectedResult)
Definition: ContentObjectRendererTest.php:3065
‪TYPO3\CMS\Core\Utility\DebugUtility\useAnsiColor
‪static useAnsiColor($ansiColorUsage)
Definition: DebugUtility.php:262
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_stdWrapValue
‪stdWrap_stdWrapValue(string $key, array $configuration, ?string $defaultValue, ?string $expected)
Definition: ContentObjectRendererTest.php:7187
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_dataDataProvider
‪array stdWrap_dataDataProvider()
Definition: ContentObjectRendererTest.php:4607
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\caseshift
‪caseshift(string $expect, string $content, string $case)
Definition: ContentObjectRendererTest.php:3456
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayContentObject
Definition: ContentObjectArrayContentObject.php:26
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_insertDataProvider
‪array stdWrap_insertDataProvider()
Definition: ContentObjectRendererTest.php:5868
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_current
‪stdWrap_current()
Definition: ContentObjectRendererTest.php:4580
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_csConvDataProvider
‪array stdWrap_csConvDataProvider()
Definition: ContentObjectRendererTest.php:4516
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_append
‪stdWrap_append()
Definition: ContentObjectRendererTest.php:3868
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapReturnsExpectation
‪stdWrapReturnsExpectation(string $content, array $configuration, string $expectation)
Definition: ContentObjectRendererTest.php:1125
‪TYPO3\CMS\Frontend\ContentObject\CaseContentObject
Definition: CaseContentObject.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\prefixComment
‪prefixComment(string $expect, string $comment, string $content)
Definition: ContentObjectRendererTest.php:7916
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrapAlign
‪stdWrap_wrapAlign(string $expect, string $content, $wrapAlignConf)
Definition: ContentObjectRendererTest.php:7810
‪TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject
Definition: FluidTemplateContentObject.php:29
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_stdWrap
‪stdWrap_stdWrap()
Definition: ContentObjectRendererTest.php:7091
‪TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
Definition: FrontendInterface.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_addPageCacheTagsAddsPageTags
‪stdWrap_addPageCacheTagsAddsPageTags(array $expectedTags, array $configuration)
Definition: ContentObjectRendererTest.php:3819
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\setUserObjectType_getUserObjectType
‪setUserObjectType_getUserObjectType()
Definition: ContentObjectRendererTest.php:7961
‪TYPO3\CMS\Core\TypoScript\TemplateService
Definition: TemplateService.php:46
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\recursiveStdWrapIsOnlyCalledOnce
‪recursiveStdWrapIsOnlyCalledOnce()
Definition: ContentObjectRendererTest.php:869
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\httpMakelinksDataProvider
‪httpMakelinksDataProvider()
Definition: ContentObjectRendererTest.php:2060
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\$cacheManager
‪ObjectProphecy $cacheManager
Definition: ContentObjectRendererTest.php:136
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typoLinkReturnsOnlyLinkTextIfNoLinkResolvingIsPossible
‪typoLinkReturnsOnlyLinkTextIfNoLinkResolvingIsPossible()
Definition: ContentObjectRendererTest.php:2979
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeFieldAndFieldIsMultiDimensional
‪getDataWithTypeFieldAndFieldIsMultiDimensional()
Definition: ContentObjectRendererTest.php:1301
‪TYPO3\CMS\Core\Resource\ResourceStorage
Definition: ResourceStorage.php:125
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static string getUniqueId($prefix='')
Definition: StringUtility.php:128
‪TYPO3\CMS\Core\ExpressionLanguage\ProviderConfigurationLoader
Definition: ProviderConfigurationLoader.php:29
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkOpensInNewWindow
‪typolinkOpensInNewWindow()
Definition: ContentObjectRendererTest.php:2939
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_ifBlankDataProvider
‪array stdWrap_ifBlankDataProvider()
Definition: ContentObjectRendererTest.php:5590
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_listNum
‪stdWrap_listNum()
Definition: ContentObjectRendererTest.php:6101
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:104
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_typolink
‪stdWrap_typolink()
Definition: ContentObjectRendererTest.php:7565
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_orderedStdWrapDataProvider
‪array stdWrap_orderedStdWrapDataProvider()
Definition: ContentObjectRendererTest.php:4113
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeLevelmedia
‪getDataWithTypeLevelmedia()
Definition: ContentObjectRendererTest.php:1439
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getImgResourceCallsGetImgResourcePostProcessHook
‪getImgResourceCallsGetImgResourcePostProcessHook()
Definition: ContentObjectRendererTest.php:228
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapBrTagDataProvider
‪array stdWrapBrTagDataProvider()
Definition: ContentObjectRendererTest.php:3941
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\invalidHttpMakelinksDataProvider
‪invalidHttpMakelinksDataProvider()
Definition: ContentObjectRendererTest.php:2184
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkReturnsCorrectLinksFiles
‪typolinkReturnsCorrectLinksFiles(string $linkText, array $configuration, string $expectedResult)
Definition: ContentObjectRendererTest.php:2739
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_fieldRequired
‪stdWrap_fieldRequired(string $expect, bool $stop, string $content, array $conf)
Definition: ContentObjectRendererTest.php:5305
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_ifNullDataProvider
‪array stdWrap_ifNullDataProvider()
Definition: ContentObjectRendererTest.php:5690
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_expandListDataProvider
‪array stdWrap_expandListDataProvider()
Definition: ContentObjectRendererTest.php:5155
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_debugFuncDataProvider
‪array stdWrap_debugFuncDataProvider()
Definition: ContentObjectRendererTest.php:4821
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\fourTypesOfStdWrapHookObjectProcessors
‪fourTypesOfStdWrapHookObjectProcessors(string $stdWrapMethod, string $hookObjectCall)
Definition: ContentObjectRendererTest.php:3676
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_date
‪stdWrap_date(string $expected, $content, array $conf, int $now)
Definition: ContentObjectRendererTest.php:4742
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:43
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_csConv
‪stdWrap_csConv(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:4561
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_bytesDataProvider
‪array stdWrap_bytesDataProvider()
Definition: ContentObjectRendererTest.php:3991
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getCurrentTable
‪getCurrentTable()
Definition: ContentObjectRendererTest.php:7839
‪TYPO3\CMS\Core\Log\Logger
Definition: Logger.php:27
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrapDoesOnlyCallIfEmptyIfTheTrimmedContentIsEmptyOrZero
‪stdWrapDoesOnlyCallIfEmptyIfTheTrimmedContentIsEmptyOrZero(string $content, bool $ifEmptyShouldBeCalled)
Definition: ContentObjectRendererTest.php:1156
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\$frontendControllerMock
‪MockObject $frontendControllerMock
Definition: ContentObjectRendererTest.php:103
‪TYPO3\CMS\Core\Core\Environment\getConfigPath
‪static string getConfigPath()
Definition: Environment.php:236
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\setCurrentFile_getCurrentFile
‪setCurrentFile_getCurrentFile()
Definition: ContentObjectRendererTest.php:7929
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_orderedStdWrap
‪stdWrap_orderedStdWrap(?array $firstConf, array $secondConf, array $conf)
Definition: ContentObjectRendererTest.php:4168
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_overrideDataProvider
‪array stdWrap_overrideDataProvider()
Definition: ContentObjectRendererTest.php:6335
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_htmlSpecialChars
‪stdWrap_htmlSpecialChars(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:5427
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_insertDataAndInputExamples
‪stdWrap_insertDataAndInputExamples($expect, string $content)
Definition: ContentObjectRendererTest.php:5885
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\HTMLcaseshift
‪HTMLcaseshift(string $expect, string $content, string $case, array $with, array $will)
Definition: ContentObjectRendererTest.php:3530
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_debug
‪stdWrap_debug()
Definition: ContentObjectRendererTest.php:4756
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeFullrootline
‪getDataWithTypeFullrootline()
Definition: ContentObjectRendererTest.php:1495
‪TYPO3\CMS\Core\Crypto\Random
Definition: Random.php:24
‪TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication
Definition: FrontendUserAuthentication.php:32
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_dateDataProvider
‪array stdWrap_dateDataProvider()
Definition: ContentObjectRendererTest.php:4697
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeParameters
‪getDataWithTypeParameters()
Definition: ContentObjectRendererTest.php:1345
‪TYPO3\CMS\Frontend\ContentObject\TextContentObject
Definition: TextContentObject.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\mailtoMakelinksReturnsNoMailToLink
‪mailtoMakelinksReturnsNoMailToLink()
Definition: ContentObjectRendererTest.php:2287
‪TYPO3\CMS\Core\Domain\Repository\PageRepository
Definition: PageRepository.php:53
‪TYPO3\CMS\Frontend\ContentObject\RecordsContentObject
Definition: RecordsContentObject.php:28
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\aTagParamsHasLeadingSpaceIfNotEmpty
‪aTagParamsHasLeadingSpaceIfNotEmpty()
Definition: ContentObjectRendererTest.php:1840
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\willThrowAnExceptionForARegisteredNonContentObject
‪willThrowAnExceptionForARegisteredNonContentObject()
Definition: ContentObjectRendererTest.php:350
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\mailtoMakelinksDataProvider
‪mailtoMakelinksDataProvider()
Definition: ContentObjectRendererTest.php:2217
‪TYPO3\CMS\Frontend\ContentObject\FilesContentObject
Definition: FilesContentObject.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getFromCache
‪getFromCache($expect, array $conf, string $cacheKey, int $times, ?string $cached)
Definition: ContentObjectRendererTest.php:3310
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_outerWrap
‪stdWrap_outerWrap(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:6322
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrapDataProvider
‪array stdWrap_wrapDataProvider()
Definition: ContentObjectRendererTest.php:7588
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_numberFormat
‪stdWrap_numberFormat()
Definition: ContentObjectRendererTest.php:6253
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_age
‪stdWrap_age()
Definition: ContentObjectRendererTest.php:3837
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\calcAgeDataProvider
‪array calcAgeDataProvider()
Definition: ContentObjectRendererTest.php:1032
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:22
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrap2
‪stdWrap_wrap2(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:7707
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrap
‪stdWrap_wrap(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:7641
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\aTagParamsHasNoLeadingSpaceIfEmpty
‪aTagParamsHasNoLeadingSpaceIfEmpty()
Definition: ContentObjectRendererTest.php:1859
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\renderingContentObjectThrowsException
‪renderingContentObjectThrowsException()
Definition: ContentObjectRendererTest.php:1870
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\httpMakelinksReturnsNoLink
‪httpMakelinksReturnsNoLink(string $data, array $configuration, string $expectedResult)
Definition: ContentObjectRendererTest.php:2212
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayInternalContentObject
Definition: ContentObjectArrayInternalContentObject.php:26
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_prioriCalc
‪stdWrap_prioriCalc($expect, string $content, array $conf)
Definition: ContentObjectRendererTest.php:6790
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_ifDataProvider
‪array stdWrap_ifDataProvider()
Definition: ContentObjectRendererTest.php:5440
‪TYPO3\CMS\Core\TimeTracker\TimeTracker
Definition: TimeTracker.php:31
‪TYPO3\CMS\Core\Resource\Exception\InvalidPathException
Definition: InvalidPathException.php:23
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\fourTypesOfStdWrapHookObjectProcessorsDataProvider
‪array fourTypesOfStdWrapHookObjectProcessorsDataProvider()
Definition: ContentObjectRendererTest.php:3639
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getFieldVal
‪getFieldVal($expect, string $fields)
Definition: ContentObjectRendererTest.php:3412
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_wrap3
‪stdWrap_wrap3(string $expected, string $input, array $conf)
Definition: ContentObjectRendererTest.php:7770
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\getDataWithTypeDebugData
‪getDataWithTypeDebugData()
Definition: ContentObjectRendererTest.php:1783
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\checkIfDataProvider
‪array checkIfDataProvider()
Definition: ContentObjectRendererTest.php:5556
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_cropHTML
‪stdWrap_cropHTML()
Definition: ContentObjectRendererTest.php:4490
‪TYPO3\CMS\Frontend\ContentObject\Exception\ProductionExceptionHandler
Definition: ProductionExceptionHandler.php:32
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\aTagParamsHaveSpaceBetweenLocalAndGlobalParams
‪aTagParamsHaveSpaceBetweenLocalAndGlobalParams()
Definition: ContentObjectRendererTest.php:1849
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_data
‪stdWrap_data(array $expect, array $data, $alt)
Definition: ContentObjectRendererTest.php:4640
‪TYPO3\CMS\Core\Context\UserAspect
Definition: UserAspect.php:37
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_splitObjReturnsCount
‪stdWrap_splitObjReturnsCount()
Definition: ContentObjectRendererTest.php:3177
‪TYPO3\CMS\Frontend\ContentObject\ContentContentObject
Definition: ContentContentObject.php:25
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\stdWrap_case
‪stdWrap_case()
Definition: ContentObjectRendererTest.php:4412
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\typolinkReturnsCorrectLinksForFilesWithAbsRefPrefixDataProvider
‪array typolinkReturnsCorrectLinksForFilesWithAbsRefPrefixDataProvider()
Definition: ContentObjectRendererTest.php:2771
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\setCurrentVal_getCurrentVal
‪setCurrentVal_getCurrentVal()
Definition: ContentObjectRendererTest.php:7946
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\exceptionHandlerIsEnabledByDefaultInProductionContext
‪exceptionHandlerIsEnabledByDefaultInProductionContext()
Definition: ContentObjectRendererTest.php:1881
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static string getVarPath()
Definition: Environment.php:218
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\recursiveStdWrapProperlyRendersBasicString
‪recursiveStdWrapProperlyRendersBasicString()
Definition: ContentObjectRendererTest.php:852