‪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  'resolveValue' => 1100,
45  'routePrefix' => 'enhance',
46  'aspectName' => 'value',
47  'inArguments' => 'staticArguments', // either 'dynamicArguments' or 'staticArguments'
48  ]);
49  return ‪Permutation::create($variables)
50  ->withTargets(
51  ‪TestSet::create($parentSet)
52  ->withMergedApplicables(‪LanguageContext::create(0))
53  ->withTargetPageId(1100)
54  ->withUrl(
56  'https://acme.us/welcome/enhance/welcome[[pathSuffix]]',
57  ‪Variables::create(['pathSuffix' => ''])
58  )
59  ),
60  ‪TestSet::create($parentSet)
61  ->withMergedApplicables(‪LanguageContext::create(1))
62  ->withTargetPageId(1100)
63  ->withUrl(
65  'https://acme.fr/bienvenue/enhance/bienvenue[[pathSuffix]]',
66  ‪Variables::create(['pathSuffix' => ''])
67  )
68  )
69  )
70  ->withApplicableItems($builder->declareEnhancers())
71  ->withApplicableSet(
72  ‪AspectDeclaration::create('PersistedAliasMapper')->withConfiguration([
73  ‪VariableItem::create('aspectName', [
74  'type' => 'PersistedAliasMapper',
75  'tableName' => 'pages',
76  'routeFieldName' => 'slug',
77  'routeValuePrefix' => '/',
78  ]),
79  ])
80  )
81  ->permute()
82  ->getTargetsForDataProvider();
83  }
84 
90  public function ‪persistedAliasMapperIsApplied(‪TestSet $testSet): void
91  {
92  $this->‪assertPageArgumentsEquals($testSet);
93  }
94 
99  {
100  $testSets = [];
101  foreach (‪Builder::create()->declarePageTypes() as $pageTypeDeclaration) {
102  $testSet = ‪TestSet::create()
103  ->withMergedApplicables($pageTypeDeclaration)
104  ->withVariables($pageTypeDeclaration->getVariables());
105  $testSets = array_merge(
106  $testSets,
107  $this->‪persistedAliasMapperDataProvider($testSet),
108  );
109  }
110  return $testSets;
111  }
112 
118  public function ‪pageTypeDecoratorIsApplied(‪TestSet $testSet): void
119  {
120  parent::pageTypeDecoratorIsApplied($testSet);
121  }
122 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerSiteRequest
Definition: AbstractEnhancerSiteRequestTest.php:18
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerSiteRequest\PersistedAliasMapperTest\pageTypeDecoratorIsAppliedDataProvider
‪array pageTypeDecoratorIsAppliedDataProvider()
Definition: PersistedAliasMapperTest.php:98
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Permutation
Definition: Permutation.php:23
‪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\EnhancerSiteRequest\PersistedAliasMapperTest\persistedAliasMapperIsApplied
‪persistedAliasMapperIsApplied(TestSet $testSet)
Definition: PersistedAliasMapperTest.php:90
‪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\EnhancerSiteRequest\PersistedAliasMapperTest
Definition: PersistedAliasMapperTest.php:33
‪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\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\EnhancerSiteRequest\AbstractEnhancerSiteRequestTest
Definition: AbstractEnhancerSiteRequestTest.php:34
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerSiteRequest\PersistedAliasMapperTest\pageTypeDecoratorIsApplied
‪pageTypeDecoratorIsApplied(TestSet $testSet)
Definition: PersistedAliasMapperTest.php:118
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerSiteRequest\AbstractEnhancerSiteRequestTest\assertPageArgumentsEquals
‪assertPageArgumentsEquals(TestSet $testSet)
Definition: AbstractEnhancerSiteRequestTest.php:147
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\AspectDeclaration
Definition: AspectDeclaration.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerSiteRequest\PersistedAliasMapperTest\persistedAliasMapperDataProvider
‪array persistedAliasMapperDataProvider($parentSet=null)
Definition: PersistedAliasMapperTest.php:38
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariableItem
Definition: VariableItem.php:21
‪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