‪TYPO3CMS  11.5
PersistedAliasMapperTest.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 
28 
33 {
38  public function ‪persistedAliasMapperDataProvider($parentSet = null): array
39  {
40  $builder = ‪Builder::create();
41  // variables (applied when invoking expectations)
42  $variables = ‪Variables::create()->define([
43  'value' => 1100,
44  'routePrefix' => 'enhance',
45  'aspectName' => 'value',
46  ]);
47  return ‪Permutation::create($variables)
48  ->withTargets(
49  ‪TestSet::create($parentSet)
50  ->withMergedApplicables(‪LanguageContext::create(0))
51  ->withTargetPageId(1100)
52  ->withUrl(
54  'https://acme.us/welcome/enhance/welcome[[pathSuffix]]',
55  ‪Variables::create(['pathSuffix' => ''])
56  )
57  ),
58  ‪TestSet::create($parentSet)
59  ->withMergedApplicables(‪LanguageContext::create(1))
60  ->withTargetPageId(1100)
61  ->withUrl(
63  'https://acme.fr/bienvenue/enhance/bienvenue[[pathSuffix]]',
64  ‪Variables::create(['pathSuffix' => ''])
65  )
66  )
67  )
68  ->withApplicableItems($builder->declareEnhancers())
69  ->withApplicableSet(
70  ‪AspectDeclaration::create('PersistedAliasMapper')->withConfiguration([
71  ‪VariableItem::create('aspectName', [
72  'type' => 'PersistedAliasMapper',
73  'tableName' => 'pages',
74  'routeFieldName' => 'slug',
75  'routeValuePrefix' => '/',
76  ]),
77  ])
78  )
79  ->permute()
80  ->getTargetsForDataProvider();
81  }
82 
88  public function ‪persistedAliasMapperIsApplied(‪TestSet $testSet): void
89  {
90  $this->‪assertGeneratedUriEquals($testSet);
91  }
92 
100  {
101  $testSets = [];
102  foreach (‪Builder::create()->declarePageTypes() as $pageTypeDeclaration) {
103  $testSet = ‪TestSet::create()
104  ->withMergedApplicables($pageTypeDeclaration)
105  ->withVariables($pageTypeDeclaration->getVariables());
106  $testSets = array_merge(
107  $testSets,
108  $this->‪persistedAliasMapperDataProvider($testSet),
109  );
110  }
111  return $testSets;
112  }
113 
119  public function ‪pageTypeDecoratorIsApplied(‪TestSet $testSet): void
120  {
121  parent::pageTypeDecoratorIsApplied($testSet);
122  }
123 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator\AbstractEnhancerLinkGeneratorTestCase\assertGeneratedUriEquals
‪assertGeneratedUriEquals(TestSet $testSet, bool $strict=true)
Definition: AbstractEnhancerLinkGeneratorTestCase.php:139
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator\PersistedAliasMapperTest\persistedAliasMapperIsApplied
‪persistedAliasMapperIsApplied(TestSet $testSet)
Definition: PersistedAliasMapperTest.php:88
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator\PersistedAliasMapperTest\pageTypeDecoratorIsApplied
‪pageTypeDecoratorIsApplied(TestSet $testSet)
Definition: PersistedAliasMapperTest.php:119
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Permutation
Definition: Permutation.php:23
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator\PersistedAliasMapperTest
Definition: PersistedAliasMapperTest.php:33
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariableItem\create
‪static create(string $key, $value)
Definition: VariableItem.php:31
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator\AbstractEnhancerLinkGeneratorTestCase
Definition: AbstractEnhancerLinkGeneratorTestCase.php:33
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\AspectDeclaration\create
‪static create(string $identifier)
Definition: AspectDeclaration.php:25
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables
Definition: Variables.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Permutation\create
‪static create(Variables $variables)
Definition: Permutation.php:44
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\TestSet
Definition: TestSet.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator\PersistedAliasMapperTest\pageTypeDecoratorIsAppliedDataProvider
‪array pageTypeDecoratorIsAppliedDataProvider()
Definition: PersistedAliasMapperTest.php:99
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Builder
Definition: Builder.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Builder\create
‪static create()
Definition: Builder.php:22
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariableValue\create
‪static create(string $value, Variables $defaultVariables=null)
Definition: VariableValue.php:43
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\create
‪static create(array $items=[])
Definition: Variables.php:22
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\AspectDeclaration
Definition: AspectDeclaration.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariableItem
Definition: VariableItem.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerLinkGenerator\PersistedAliasMapperTest\persistedAliasMapperDataProvider
‪array persistedAliasMapperDataProvider($parentSet=null)
Definition: PersistedAliasMapperTest.php:38
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\LanguageContext
Definition: LanguageContext.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariableValue
Definition: VariableValue.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\TestSet\create
‪static create($parentSet=null)
Definition: TestSet.php:42
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\LanguageContext\create
‪static create(int $languageId)
Definition: LanguageContext.php:24