‪TYPO3CMS  11.5
AbstractSoftReferenceParserTest.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 Prophecy\PhpUnit\ProphecyTrait;
21 use Psr\EventDispatcher\EventDispatcherInterface;
22 use Psr\Log\LoggerInterface;
33 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
34 
38 abstract class ‪AbstractSoftReferenceParserTest extends UnitTestCase
39 {
40  use ProphecyTrait;
41 
42  protected ‪$resetSingletonInstances = true;
43 
44  protected function ‪getParserByKey($softrefKey): ‪SoftReferenceParserInterface
45  {
46  $eventDispatcher = $this->prophesize(EventDispatcherInterface::class);
47  $runtimeCache = $this->prophesize(FrontendInterface::class);
48  $logger = $this->prophesize(LoggerInterface::class);
49 
50  $softReferenceParserFactory = new ‪SoftReferenceParserFactory($runtimeCache->reveal(), $logger->reveal());
51  $softReferenceParserFactory->addParser(new ‪SubstituteSoftReferenceParser(), 'substitute');
52  $softReferenceParserFactory->addParser(new ‪NotifySoftReferenceParser(), 'notify');
53  $softReferenceParserFactory->addParser(new ‪TypolinkSoftReferenceParser($eventDispatcher->reveal()), 'typolink');
54  $softReferenceParserFactory->addParser(new ‪TypolinkTagSoftReferenceParser(), 'typolink_tag');
55  $softReferenceParserFactory->addParser(new ‪ExtensionPathSoftReferenceParser(), 'ext_fileref');
56  $softReferenceParserFactory->addParser(new ‪EmailSoftReferenceParser(), 'email');
57  $softReferenceParserFactory->addParser(new ‪UrlSoftReferenceParser(), 'url');
58 
59  return $softReferenceParserFactory->getSoftReferenceParser($softrefKey);
60  }
61 }
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserFactory
Definition: SoftReferenceParserFactory.php:28
‪TYPO3\CMS\Core\DataHandling\SoftReference\EmailSoftReferenceParser
Definition: EmailSoftReferenceParser.php:24
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface
Definition: SoftReferenceParserInterface.php:31
‪TYPO3\CMS\Core\DataHandling\SoftReference\ExtensionPathSoftReferenceParser
Definition: ExtensionPathSoftReferenceParser.php:24
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\AbstractSoftReferenceParserTest\$resetSingletonInstances
‪$resetSingletonInstances
Definition: AbstractSoftReferenceParserTest.php:41
‪TYPO3\CMS\Core\DataHandling\SoftReference\NotifySoftReferenceParser
Definition: NotifySoftReferenceParser.php:24
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference
Definition: AbstractSoftReferenceParserTest.php:18
‪TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
Definition: FrontendInterface.php:22
‪TYPO3\CMS\Core\DataHandling\SoftReference\SubstituteSoftReferenceParser
Definition: SubstituteSoftReferenceParser.php:24
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\AbstractSoftReferenceParserTest
Definition: AbstractSoftReferenceParserTest.php:39
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\AbstractSoftReferenceParserTest\getParserByKey
‪getParserByKey($softrefKey)
Definition: AbstractSoftReferenceParserTest.php:43
‪TYPO3\CMS\Core\DataHandling\SoftReference\UrlSoftReferenceParser
Definition: UrlSoftReferenceParser.php:24