‪TYPO3CMS  10.4
TestSetDataProviderTrait.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 ‪nestedRouteArgumentsAreConsideredDataProvider($parentSet = null): array
39  {
40  $routePath = ‪VariableValue::create(
41  '/enhance/[[routeParameter]]',
42  ‪Variables::create(['routeParameter' => '{known_value}'])
43  );
44  $cHashVar = ‪Variable::create('cHash', ‪Variable::CAST_STRING);
45  $resolveValueVar = ‪Variable::create('resolveValue', ‪Variable::CAST_STRING);
46  // variables (applied when invoking expectations)
47  $variables = ‪Variables::create()->define([
48  'aspectName' => 'value',
49  ]);
50  $enhancers = [
51  'Simple' => ‪EnhancerDeclaration::create('Simple')
52  ->withConfiguration([
53  'type' => 'Simple',
54  'routePath' => $routePath,
55  '_arguments' => [
56  'known_value' => 'known/value'
57  ],
58  ])
59  ->withGenerateParameters([
60  ‪VariableValue::create('&known[value]=[[value]]&any[other]=other')
61  ->withRequiredDefinedVariableNames('value'),
62  ])
63  ->withResolveArguments([
64  'routeArguments' => [
65  'known' => ['value' => $resolveValueVar],
66  ],
67  'dynamicArguments' => [
68  'known' => ['value' => $resolveValueVar],
69  'any' => ['other' => 'other'],
70  'cHash' => $cHashVar,
71  ],
72  'queryArguments' => [
73  'any' => ['other' => 'other'],
74  'cHash' => $cHashVar,
75  ],
76  ]),
77  'Plugin' => ‪EnhancerDeclaration::create('Plugin')
78  ->withConfiguration([
79  'type' => 'Plugin',
80  'routePath' => $routePath,
81  'namespace' => 'testing',
82  '_arguments' => [
83  'known_value' => 'known/value'
84  ],
85  ])
86  ->withGenerateParameters([
87  ‪VariableValue::create('&testing[known][value]=[[value]]&testing[any][other]=other')
88  ->withRequiredDefinedVariableNames('value'),
89  ])
90  ->withResolveArguments([
91  'routeArguments' => [
92  'testing' => [
93  'known' => ['value' => $resolveValueVar],
94  ],
95  ],
96  'dynamicArguments' => [
97  'testing' => [
98  'known' => ['value' => $resolveValueVar],
99  'any' => ['other' => 'other'],
100  ],
101  'cHash' => $cHashVar,
102  ],
103  'queryArguments' => [
104  'testing' => [
105  'any' => ['other' => 'other'],
106  ],
107  'cHash' => $cHashVar,
108  ],
109  ]),
110  'Extbase' => ‪EnhancerDeclaration::create('Extbase')
111  ->withConfiguration([
112  'type' => 'Extbase',
113  'defaultController' => 'Link::index',
114  'extension' => 'testing',
115  'plugin' => 'link',
116  'routes' => [
117  [
118  'routePath' => $routePath,
119  '_controller' => 'Link::index',
120  '_arguments' => ['known_value' => 'known/value'],
121  ],
122  ],
123  ])
124  ->withGenerateParameters([
125  ‪VariableValue::create('&tx_testing_link[known][value]=[[value]]&tx_testing_link[any][other]=other')
126  ->withRequiredDefinedVariableNames('value'),
127  ])
128  ->withResolveArguments([
129  'routeArguments' => [
130  'tx_testing_link' => [
131  'known' => ['value' => $resolveValueVar],
132  'controller' => 'Link',
133  'action' => 'index',
134  ],
135  ],
136  'dynamicArguments' => [
137  'tx_testing_link' => [
138  'known' => ['value' => $resolveValueVar],
139  'any' => ['other' => 'other'],
140  ],
141  'cHash' => $cHashVar,
142  ],
143  'staticArguments' => [
144  'tx_testing_link' => [
145  'controller' => 'Link',
146  'action' => 'index',
147  ],
148  ],
149  'queryArguments' => [
150  'tx_testing_link' => [
151  'any' => ['other' => 'other'],
152  ],
153  'cHash' => $cHashVar,
154  ],
155  ]),
156  ];
157 
158  return ‪Permutation::create($variables)
159  ->withTargets(
160  ‪TestSet::create($parentSet)
161  ->withMergedApplicables(‪LanguageContext::create(0))
162  ->withTargetPageId(1100)
163  ->withUrl(
165  'https://acme.us/welcome/enhance/[[resolveValue]][[pathSuffix]]',
166  ‪Variables::create(['pathSuffix' => ''])
167  )
168  )
169  )
170  ->withApplicableSet(
172  'value' => 'known',
173  'resolveValue' => 'known',
174  ]))
175  )
176  ->withApplicableItems($enhancers)
177  ->withApplicableSet(
179  'pathSuffix' => '?any%5Bother%5D=other&cHash=[[cHash]]',
180  'cHash' => 'a655d1f1d346f7d3fa7aef5459a6547f',
181  ]))->withRequiredApplicables($enhancers['Simple']),
183  'pathSuffix' => '?testing%5Bany%5D%5Bother%5D=other&cHash=[[cHash]]',
184  'cHash' => 'bfd5274d1f8a5051f44ca703a0dbd359',
185  ]))->withRequiredApplicables($enhancers['Plugin']),
187  'pathSuffix' => '?tx_testing_link%5Bany%5D%5Bother%5D=other&cHash=[[cHash]]',
188  'cHash' => '0d1b27ac1cc957c16c9c02cf24f90af4',
189  ]))->withRequiredApplicables($enhancers['Extbase'])
190  )
191  ->permute()
192  ->getTargetsForDataProvider();
193  }
194 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variable
Definition: Variable.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Permutation
Definition: Permutation.php:23
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\TestSetDataProviderTrait
Definition: TestSetDataProviderTrait.php:33
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables
Definition: Variables.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariablesContext\create
‪static create(Variables $variables)
Definition: VariablesContext.php:28
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariablesContext
Definition: VariablesContext.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Permutation\create
‪static create(Variables $variables)
Definition: Permutation.php:40
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\TestSet
Definition: TestSet.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\TestSetDataProviderTrait\nestedRouteArgumentsAreConsideredDataProvider
‪TestSet[] nestedRouteArgumentsAreConsideredDataProvider($parentSet=null)
Definition: TestSetDataProviderTrait.php:38
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\VariableValue\create
‪static create(string $value, Variables $defaultVariables=null)
Definition: VariableValue.php:39
‪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\EnhancerDeclaration\create
‪static create(string $identifier)
Definition: EnhancerDeclaration.php:38
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling
Definition: AbstractTestCase.php:18
‪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\EnhancerDeclaration
Definition: EnhancerDeclaration.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\TestSet\create
‪static create($parentSet=null)
Definition: TestSet.php:38
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\LanguageContext\create
‪static create(int $languageId)
Definition: LanguageContext.php:24
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variable\create
‪static create(string $variableName, int $cast=self::CAST_NONE)
Definition: Variable.php:35
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variable\CAST_STRING
‪const CAST_STRING
Definition: Variable.php:23