2 declare(strict_types = 1);
21 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory;
22 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter;
23 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\TypoScriptInstruction;
24 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
25 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext;
35 private $siteTitle =
'A Company that Manufactures Everything Inc';
44 parent::setUpBeforeClass();
45 static::initializeDatabaseSnapshot();
50 static::destroyDatabaseSnapshot();
51 parent::tearDownAfterClass();
54 protected function setUp()
59 $this->internalRequestContext = (
new InternalRequestContext())
60 ->withGlobalSettings([
'TYPO3_CONF_VARS' => static::TYPO3_CONF_VARS]);
88 $this->withDatabaseSnapshot(
function () {
95 $backendUser = $this->setUpBackendUserFromFixture(1);
98 $scenarioFile = __DIR__ .
'/Fixtures/SlugScenario.yaml';
99 $factory = DataHandlerFactory::fromYamlFile($scenarioFile);
100 $writer = DataHandlerWriter::withBackendUser($backendUser);
101 $writer->invokeFactory($factory);
102 static::failIfArrayIsNotEmpty(
106 $this->setUpFrontendRootPage(
109 'typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/LinkGenerator.typoscript',
112 'title' =>
'ACME Root',
113 'sitetitle' => $this->siteTitle,
116 $this->setUpFrontendRootPage(
119 'typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/LinkGenerator.typoscript',
122 'title' =>
'ACME Blog',
123 'sitetitle' => $this->siteTitle,
130 unset($this->internalRequestContext);
141 [
'https://acme.us/', 1100, 1000,
'/'],
142 [
'https://acme.us/', 1100, 1100,
'/welcome'],
143 [
'https://acme.us/', 1100, 1200,
'/features'],
144 [
'https://acme.us/', 1100, 1210,
'/features/frontend-editing'],
145 [
'https://acme.us/', 1100, 404,
'/404'],
147 [
'https://acme.us/', 1100, 1300,
'https://products.acme.com/products'],
148 [
'https://acme.us/', 1100, 1310,
'https://products.acme.com/products/planets'],
150 [
'https://acme.us/', 1100, 2000,
'https://blog.acme.com/'],
151 [
'https://acme.us/', 1100, 2100,
'https://blog.acme.com/authors'],
152 [
'https://acme.us/', 1100, 2110,
'https://blog.acme.com/john/john'],
153 [
'https://acme.us/', 1100, 2111,
'https://blog.acme.com/john/about-john'],
155 [
'https://blog.acme.com/', 2100, 1000,
'https://acme.us/'],
156 [
'https://blog.acme.com/', 2100, 1100,
'https://acme.us/welcome'],
157 [
'https://blog.acme.com/', 2100, 1200,
'https://acme.us/features'],
158 [
'https://blog.acme.com/', 2100, 1210,
'https://acme.us/features/frontend-editing'],
159 [
'https://blog.acme.com/', 2100, 404,
'https://acme.us/404'],
161 [
'https://blog.acme.com/', 2100, 1300,
'https://products.acme.com/products'],
162 [
'https://blog.acme.com/', 2100, 1310,
'https://products.acme.com/products/planets'],
165 return $this->keysFromTemplate(
180 public function linkIsGenerated(
string $hostPrefix,
int $sourcePageId,
int $targetPageId,
string $expectation)
182 $response = $this->executeFrontendRequest(
183 (
new InternalRequest($hostPrefix))
184 ->withPageId($sourcePageId)
186 $this->createTypoLinkUrlInstruction([
187 'parameter' => $targetPageId,
190 $this->internalRequestContext
193 static::assertSame($expectation, (
string)$response->getBody());
203 [
'https://acme.us/', [7100, 1700], 7110, 1000,
'/'],
204 [
'https://acme.us/', [7100, 1700], 7110, 1100,
'/welcome'],
205 [
'https://acme.us/', [7100, 1700], 7110, 1200,
'/features'],
206 [
'https://acme.us/', [7100, 1700], 7110, 1210,
'/features/frontend-editing'],
207 [
'https://acme.us/', [7100, 1700], 7110, 404,
'/404'],
209 [
'https://acme.us/', [7100, 1700], 7110, 1300,
'https://products.acme.com/products'],
210 [
'https://acme.us/', [7100, 1700], 7110, 1310,
'https://products.acme.com/products/planets'],
212 [
'https://acme.us/', [7100, 1700], 7110, 2000,
'https://blog.acme.com/'],
213 [
'https://acme.us/', [7100, 1700], 7110, 2100,
'https://blog.acme.com/authors'],
214 [
'https://acme.us/', [7100, 1700], 7110, 2110,
'https://blog.acme.com/john/john'],
215 [
'https://acme.us/', [7100, 1700], 7110, 2111,
'https://blog.acme.com/john/about-john'],
217 [
'https://blog.acme.com/', [7100, 2700], 7110, 1000,
'https://acme.us/'],
218 [
'https://blog.acme.com/', [7100, 2700], 7110, 1100,
'https://acme.us/welcome'],
219 [
'https://blog.acme.com/', [7100, 2700], 7110, 1200,
'https://acme.us/features'],
220 [
'https://blog.acme.com/', [7100, 2700], 7110, 1210,
'https://acme.us/features/frontend-editing'],
221 [
'https://blog.acme.com/', [7100, 2700], 7110, 404,
'https://acme.us/404'],
223 [
'https://blog.acme.com/', [7100, 2700], 7110, 1300,
'https://products.acme.com/products'],
224 [
'https://blog.acme.com/', [7100, 2700], 7110, 1310,
'https://products.acme.com/products/planets'],
227 return $this->keysFromTemplate(
229 '%3$d->%4$d (mount:%2$s)',
230 function (array $items) {
235 [implode(
'->', $items[1])]
254 $response = $this->executeFrontendRequest(
255 (
new InternalRequest($hostPrefix))
256 ->withMountPoint(...$pageMount)
257 ->withPageId($sourcePageId)
259 $this->createTypoLinkUrlInstruction([
260 'parameter' => $targetPageId,
263 $this->internalRequestContext
266 static::assertSame($expectation, (
string)$response->getBody());
276 [
'https://acme.us/', 1100, 1100, 0,
'/welcome'],
277 [
'https://acme.us/', 1100, 1100, 1,
'https://acme.fr/bienvenue'],
278 [
'https://acme.us/', 1100, 1100, 2,
'https://acme.ca/bienvenue'],
279 [
'https://acme.us/', 1100, 1101, 0,
'https://acme.fr/bienvenue'],
280 [
'https://acme.us/', 1100, 1102, 0,
'https://acme.ca/bienvenue'],
282 [
'https://acme.us/', 1100, 1300, 0,
'https://products.acme.com/products'],
283 [
'https://acme.us/', 1100, 1310, 0,
'https://products.acme.com/products/planets'],
285 [
'https://acme.us/', 1100, 1410, 0,
''],
286 [
'https://acme.us/', 1100, 1410, 1,
'https://acme.fr/acme-dans-votre-region/groupes'],
287 [
'https://acme.us/', 1100, 1410, 2,
'https://acme.ca/acme-dans-votre-quebec/groupes'],
288 [
'https://acme.us/', 1100, 1411, 0,
'https://acme.fr/acme-dans-votre-region/groupes'],
289 [
'https://acme.us/', 1100, 1412, 0,
'https://acme.ca/acme-dans-votre-quebec/groupes'],
291 [
'https://acme.us/', 1100, 3100, 0,
'/index.php?id=3100&L=0'],
292 [
'https://acme.us/', 1100, 3100, 1,
'/index.php?id=3100&L=1'],
293 [
'https://acme.us/', 1100, 3100, 2,
'/index.php?id=3100&L=2'],
294 [
'https://acme.us/', 1100, 3101, 0,
'/index.php?id=3100&L=1'],
295 [
'https://acme.us/', 1100, 3102, 0,
'/index.php?id=3100&L=2'],
297 [
'https://blog.acme.com/', 2100, 1100, 0,
'https://acme.us/welcome'],
298 [
'https://blog.acme.com/', 2100, 1100, 1,
'https://acme.fr/bienvenue'],
299 [
'https://blog.acme.com/', 2100, 1100, 2,
'https://acme.ca/bienvenue'],
300 [
'https://blog.acme.com/', 2100, 1101, 0,
'https://acme.fr/bienvenue'],
301 [
'https://blog.acme.com/', 2100, 1102, 0,
'https://acme.ca/bienvenue'],
303 [
'https://blog.acme.com/', 2100, 3100, 0,
'/index.php?id=3100&L=0'],
304 [
'https://blog.acme.com/', 2100, 3100, 1,
'/index.php?id=3100&L=1'],
305 [
'https://blog.acme.com/', 2100, 3100, 2,
'/index.php?id=3100&L=2'],
306 [
'https://blog.acme.com/', 2100, 3101, 0,
'/index.php?id=3100&L=1'],
307 [
'https://blog.acme.com/', 2100, 3102, 0,
'/index.php?id=3100&L=2'],
309 [
'https://blog.acme.com/', 2100, 1300, 0,
'https://products.acme.com/products'],
310 [
'https://blog.acme.com/', 2100, 1310, 0,
'https://products.acme.com/products/planets'],
313 return $this->keysFromTemplate(
315 '%2$d->%3$d (lang:%4$d)'
331 $response = $this->executeFrontendRequest(
332 (
new InternalRequest($hostPrefix))
333 ->withPageId($sourcePageId)
335 $this->createTypoLinkUrlInstruction([
336 'parameter' => $targetPageId,
337 'language' => $targetLanguageId,
340 $this->internalRequestContext
343 static::assertSame($expectation, (
string)$response->getBody());
358 $response = $this->executeFrontendRequest(
359 (
new InternalRequest($hostPrefix))
360 ->withPageId($sourcePageId)
362 $this->createTypoLinkUrlInstruction([
363 'parameter' => $targetPageId,
364 'additionalParams' =>
'&L=' . $targetLanguageId,
367 $this->internalRequestContext
370 static::assertSame($expectation, (
string)$response->getBody());
380 [
'https://acme.us/', 1100, 1000,
'/?testing%5Bvalue%5D=1&cHash=7d1f13fa91159dac7feb3c824936b39d'],
381 [
'https://acme.us/', 1100, 1100,
'/welcome?testing%5Bvalue%5D=1&cHash=f42b850e435f0cedd366f5db749fc1af'],
382 [
'https://acme.us/', 1100, 1200,
'/features?testing%5Bvalue%5D=1&cHash=784e11c50ea1a13fd7d969df4ec53ea3'],
383 [
'https://acme.us/', 1100, 1210,
'/features/frontend-editing?testing%5Bvalue%5D=1&cHash=ccb7067022b9835ebfd8f720722bc708'],
384 [
'https://acme.us/', 1100, 404,
'/404?testing%5Bvalue%5D=1&cHash=864e96f586a78a53452f3bf0f4d24591'],
386 [
'https://acme.us/', 1100, 1300,
'https://products.acme.com/products?testing%5Bvalue%5D=1&cHash=dbd6597d72ed5098cce3d03eac1eeefe'],
387 [
'https://acme.us/', 1100, 1310,
'https://products.acme.com/products/planets?testing%5Bvalue%5D=1&cHash=e64bfc7ab7dd6b70d161e4d556be9726'],
389 [
'https://acme.us/', 1100, 2000,
'https://blog.acme.com/?testing%5Bvalue%5D=1&cHash=a14da633e46dba71640cb85226cd12c5'],
390 [
'https://acme.us/', 1100, 2100,
'https://blog.acme.com/authors?testing%5Bvalue%5D=1&cHash=d23d74cb50383f8788a9930ec8ba679f'],
391 [
'https://acme.us/', 1100, 2110,
'https://blog.acme.com/john/john?testing%5Bvalue%5D=1&cHash=bf25eea89f44a9a79dabdca98f38a432'],
392 [
'https://acme.us/', 1100, 2111,
'https://blog.acme.com/john/about-john?testing%5Bvalue%5D=1&cHash=42dbaeb9172b6b1ca23b49941e194db2'],
394 [
'https://blog.acme.com/', 2100, 1000,
'https://acme.us/?testing%5Bvalue%5D=1&cHash=7d1f13fa91159dac7feb3c824936b39d'],
395 [
'https://blog.acme.com/', 2100, 1100,
'https://acme.us/welcome?testing%5Bvalue%5D=1&cHash=f42b850e435f0cedd366f5db749fc1af'],
396 [
'https://blog.acme.com/', 2100, 1200,
'https://acme.us/features?testing%5Bvalue%5D=1&cHash=784e11c50ea1a13fd7d969df4ec53ea3'],
397 [
'https://blog.acme.com/', 2100, 1210,
'https://acme.us/features/frontend-editing?testing%5Bvalue%5D=1&cHash=ccb7067022b9835ebfd8f720722bc708'],
398 [
'https://blog.acme.com/', 2100, 404,
'https://acme.us/404?testing%5Bvalue%5D=1&cHash=864e96f586a78a53452f3bf0f4d24591'],
400 [
'https://blog.acme.com/', 2100, 1300,
'https://products.acme.com/products?testing%5Bvalue%5D=1&cHash=dbd6597d72ed5098cce3d03eac1eeefe'],
401 [
'https://blog.acme.com/', 2100, 1310,
'https://products.acme.com/products/planets?testing%5Bvalue%5D=1&cHash=e64bfc7ab7dd6b70d161e4d556be9726'],
404 return $this->keysFromTemplate(
421 $response = $this->executeFrontendRequest(
422 (
new InternalRequest($hostPrefix))
423 ->withPageId($sourcePageId)
425 $this->createTypoLinkUrlInstruction([
426 'parameter' => $targetPageId,
427 'additionalParams' =>
'&testing[value]=1',
431 $this->internalRequestContext
434 static::assertSame($expectation, (
string)$response->getBody());
443 [
'https://acme.us/', 1100, 1510, 0,
''],
445 [
'https://acme.us/', 1100, 1512, 0,
''],
446 [
'https://acme.us/', 1100, 1515, 0,
''],
447 [
'https://acme.us/', 1100, 1520, 0,
''],
450 [
'https://acme.us/', 1100, 1510, 1,
'/my-acme/whitepapers'],
451 [
'https://acme.us/', 1100, 1511, 1,
'/my-acme/whitepapers/products'],
452 [
'https://acme.us/', 1100, 1512, 1,
'/my-acme/whitepapers/solutions'],
453 [
'https://acme.us/', 1100, 1515, 1,
''],
454 [
'https://acme.us/', 1100, 1520, 1,
''],
457 [
'https://acme.us/', 1100, 1510, 2,
'/my-acme/whitepapers'],
458 [
'https://acme.us/', 1100, 1511, 2,
'/my-acme/whitepapers/products'],
459 [
'https://acme.us/', 1100, 1512, 2,
''],
460 [
'https://acme.us/', 1100, 1515, 2,
'/my-acme/whitepapers/research'],
461 [
'https://acme.us/', 1100, 1520, 2,
'/my-acme/forecasts'],
462 [
'https://acme.us/', 1100, 1521, 2,
'/my-acme/forecasts/current-year'],
464 [
'https://acme.us/', 1100, 1510, 3,
'/my-acme/whitepapers'],
465 [
'https://acme.us/', 1100, 1511, 3,
'/my-acme/whitepapers/products'],
466 [
'https://acme.us/', 1100, 1512, 3,
'/my-acme/whitepapers/solutions'],
467 [
'https://acme.us/', 1100, 1515, 3,
'/my-acme/whitepapers/research'],
468 [
'https://acme.us/', 1100, 1520, 3,
'/my-acme/forecasts'],
469 [
'https://acme.us/', 1100, 1521, 3,
'/my-acme/forecasts/current-year'],
472 return $this->keysFromTemplate(
474 '%2$d->%3$d (user:%4$d)'
490 $response = $this->executeFrontendRequest(
491 (
new InternalRequest($hostPrefix))
492 ->withPageId($sourcePageId)
494 $this->createTypoLinkUrlInstruction([
495 'parameter' => $targetPageId,
498 $this->internalRequestContext
499 ->withFrontendUserId($frontendUserId)
502 static::assertSame($expectation, (
string)$response->getBody());
512 [
'https://acme.us/', 1100, 1510, 1500, 0,
'/my-acme?pageId=1510&cHash=119c4870e323bb7e8c9fae2941726b0d'],
514 [
'https://acme.us/', 1100, 1512, 1500, 0,
'/my-acme?pageId=1512&cHash=0ced3db0fd4aae0019a99f59cfa58cb0'],
515 [
'https://acme.us/', 1100, 1515, 1500, 0,
'/my-acme?pageId=1515&cHash=176f16b31d2c731347d411861d8b06dc'],
516 [
'https://acme.us/', 1100, 1520, 1500, 0,
'/my-acme?pageId=1520&cHash=253d3dccd4794c4a9473226f683bc36a'],
519 [
'https://acme.us/', 1100, 1510, 1500, 1,
'/my-acme/whitepapers'],
520 [
'https://acme.us/', 1100, 1511, 1500, 1,
'/my-acme/whitepapers/products'],
521 [
'https://acme.us/', 1100, 1512, 1500, 1,
'/my-acme/whitepapers/solutions'],
522 [
'https://acme.us/', 1100, 1515, 1500, 1,
'/my-acme?pageId=1515&cHash=176f16b31d2c731347d411861d8b06dc'],
523 [
'https://acme.us/', 1100, 1520, 1500, 1,
'/my-acme?pageId=1520&cHash=253d3dccd4794c4a9473226f683bc36a'],
526 [
'https://acme.us/', 1100, 1510, 1500, 2,
'/my-acme/whitepapers'],
527 [
'https://acme.us/', 1100, 1511, 1500, 2,
'/my-acme/whitepapers/products'],
528 [
'https://acme.us/', 1100, 1512, 1500, 2,
'/my-acme?pageId=1512&cHash=0ced3db0fd4aae0019a99f59cfa58cb0'],
529 [
'https://acme.us/', 1100, 1515, 1500, 2,
'/my-acme/whitepapers/research'],
530 [
'https://acme.us/', 1100, 1520, 1500, 2,
'/my-acme/forecasts'],
531 [
'https://acme.us/', 1100, 1521, 1500, 2,
'/my-acme/forecasts/current-year'],
533 [
'https://acme.us/', 1100, 1510, 1500, 3,
'/my-acme/whitepapers'],
534 [
'https://acme.us/', 1100, 1511, 1500, 3,
'/my-acme/whitepapers/products'],
535 [
'https://acme.us/', 1100, 1512, 1500, 3,
'/my-acme/whitepapers/solutions'],
536 [
'https://acme.us/', 1100, 1515, 1500, 3,
'/my-acme/whitepapers/research'],
537 [
'https://acme.us/', 1100, 1520, 1500, 3,
'/my-acme/forecasts'],
538 [
'https://acme.us/', 1100, 1521, 1500, 3,
'/my-acme/forecasts/current-year'],
541 return $this->keysFromTemplate(
543 '%2$d->%3$d (via: %4$d, user:%5$d)'
560 $response = $this->executeFrontendRequest(
561 (
new InternalRequest($hostPrefix))
562 ->withPageId($sourcePageId)
564 (
new TypoScriptInstruction(TemplateService::class))
567 'typolinkLinkAccessRestrictedPages' => $loginPageId,
568 'typolinkLinkAccessRestrictedPages_addParams' =>
'&pageId=###PAGE_ID###'
571 $this->createTypoLinkUrlInstruction([
572 'parameter' => $targetPageId,
575 $this->internalRequestContext
576 ->withFrontendUserId($frontendUserId)
579 static::assertSame($expectation, (
string)$response->getBody());
589 [
'https://acme.us/', 1100, 1510, 0,
'/my-acme/whitepapers'],
590 [
'https://acme.us/', 1100, 1512, 0,
'/my-acme/whitepapers/solutions'],
591 [
'https://acme.us/', 1100, 1515, 0,
'/my-acme/whitepapers/research'],
593 [
'https://acme.fr/', 1100, 1510, 1,
'/my-acme/papiersblanc'],
594 [
'https://acme.fr/', 1100, 1512, 1,
'/my-acme/papiersblanc/la-solutions'],
595 [
'https://acme.fr/', 1100, 1515, 1,
'/my-acme/papiersblanc/recherche'],
597 [
'https://acme.ca/', 1100, 1510, 2,
'/my-acme-ca/papiersblanc'],
598 [
'https://acme.ca/', 1100, 1512, 2,
'/my-acme-ca/papiersblanc/la-solutions'],
599 [
'https://acme.ca/', 1100, 1515, 2,
'/my-acme-ca/papiersblanc/recherche'],
602 return $this->keysFromTemplate(
604 '%2$d->%3$d (language: %4$d)'
620 $response = $this->executeFrontendRequest(
621 (
new InternalRequest($hostPrefix))
622 ->withPageId($sourcePageId)
624 (
new TypoScriptInstruction(TemplateService::class))
627 'typolinkLinkAccessRestrictedPages' =>
'NONE',
630 $this->createTypoLinkUrlInstruction([
631 'parameter' => $targetPageId,
634 $this->internalRequestContext
637 self::assertSame($expectation, (
string)$response->getBody());
647 [
'https://acme.us/', 1100, 1100,
false, 1,
'/welcome-modified'],
648 [
'https://acme.us/', 1100, 1100,
true, 1,
'/welcome-modified'],
649 [
'https://acme.us/', 1100, 1100,
false, 0,
'/welcome'],
650 [
'https://acme.us/', 1100, 1100,
true, 0,
'/index.php?id=acme-first'],
652 [
'https://acme.us/', 1100, 1950,
false, 1,
'/bye'],
653 [
'https://acme.us/', 1100, 1950,
true, 1,
'/bye'],
654 [
'https://acme.us/', 1100, 1950,
false, 0,
''],
655 [
'https://acme.us/', 1100, 1950,
true, 0,
'/index.php?id={targetPageId}'],
657 [
'https://blog.acme.com/', 2100, 1100,
true, 1,
'https://acme.us/welcome-modified'],
658 [
'https://blog.acme.com/', 2100, 1100,
false, 1,
'https://acme.us/welcome-modified'],
659 [
'https://blog.acme.com/', 2100, 1100,
false, 0,
'https://acme.us/welcome'],
660 [
'https://blog.acme.com/', 2100, 1100,
true, 0,
'/index.php?id=acme-first'],
662 [
'https://blog.acme.com/', 2100, 1950,
false, 1,
'https://acme.us/bye'],
663 [
'https://blog.acme.com/', 2100, 1950,
true, 1,
'https://acme.us/bye'],
664 [
'https://blog.acme.com/', 2100, 1950,
false, 0,
''],
665 [
'https://blog.acme.com/', 2100, 1950,
true, 0,
'/index.php?id={targetPageId}'],
668 return $this->keysFromTemplate(
670 '%2$d->%3$d (resolve:%4$d, be_user:%5$d)'
685 public function linkIsGeneratedForPageVersion(
string $hostPrefix,
int $sourcePageId,
int $targetPageId,
bool $resolveVersion,
int $backendUserId,
string $expectation)
688 if ($resolveVersion) {
697 $response = $this->executeFrontendRequest(
698 (
new InternalRequest($hostPrefix))
699 ->withPageId($sourcePageId)
701 $this->createTypoLinkUrlInstruction([
702 'parameter' => $targetPageId,
705 $this->internalRequestContext
706 ->withWorkspaceId($backendUserId !== 0 ? $workspaceId : 0)
707 ->withBackendUserId($backendUserId)
710 $expectation = str_replace(
716 static::assertSame($expectation, (
string)$response->getBody());
729 [
'title' =>
'EN: Welcome',
'link' =>
'/welcome'],
731 'title' =>
'EN: Features',
732 'link' =>
'/features',
735 'title' =>
'EN: Frontend Editing',
736 'link' =>
'/features/frontend-editing',
741 'title' =>
'EN: Products',
742 'link' =>
'https://products.acme.com/products',
745 'title' =>
'EN: Planets',
746 'link' =>
'https://products.acme.com/products/planets',
749 'title' =>
'EN: Spaceships',
750 'link' =>
'https://products.acme.com/products/spaceships',
753 'title' =>
'EN: Dark Matter',
754 'link' =>
'https://products.acme.com/products/dark-matter',
758 [
'title' =>
'EN: ACME in your Region',
'link' =>
'/acme-in-your-region'],
759 [
'title' =>
'Internal',
'link' =>
'/my-acme'],
760 [
'title' =>
'About us',
'link' =>
'/about'],
762 'title' =>
'Announcements & News',
766 'title' =>
'Markets',
767 'link' =>
'/news/common/markets',
770 'title' =>
'Products',
771 'link' =>
'/news/common/products',
774 'title' =>
'Partners',
775 'link' =>
'/news/common/partners',
779 [
'title' =>
'Page not found',
'link' =>
'/404'],
780 [
'title' =>
'Our Blog',
'link' =>
'https://blog.acme.com/authors'],
784 'https://blog.acme.com/',
788 'title' =>
'Authors',
789 'link' =>
'/authors',
792 'title' =>
'John Doe',
793 'link' =>
'https://blog.acme.com/john/john',
796 'title' =>
'Jane Doe',
797 'link' =>
'https://blog.acme.com/jane/jane',
803 'title' =>
'Announcements & News',
807 'title' =>
'Markets',
808 'link' =>
'/news/common/markets',
811 'title' =>
'Products',
812 'link' =>
'/news/common/products',
815 'title' =>
'Partners',
816 'link' =>
'/news/common/partners',
820 [
'title' =>
'ACME Inc',
'link' =>
'https://acme.us/welcome'],
836 $response = $this->executeFrontendRequest(
837 (
new InternalRequest($hostPrefix))
838 ->withPageId($sourcePageId)
840 $this->createHierarchicalMenuProcessorInstruction([
844 'includeSpacer' => 1,
845 'titleField' =>
'title',
848 $this->internalRequestContext
851 $json = json_decode((
string)$response->getBody(),
true);
852 $json = $this->filterMenu($json);
854 static::assertSame($expectation, $json);
867 [
'title' =>
'English',
'link' =>
'/welcome'],
868 [
'title' =>
'French',
'link' =>
'https://acme.fr/bienvenue'],
869 [
'title' =>
'Franco-Canadian',
'link' =>
'https://acme.ca/bienvenue'],
876 [
'title' =>
'English',
'link' =>
'https://acme.us/welcome'],
877 [
'title' =>
'French',
'link' =>
'/bienvenue'],
878 [
'title' =>
'Franco-Canadian',
'link' =>
'https://acme.ca/bienvenue'],
881 'ACME Inc (FR-CA)' => [
885 [
'title' =>
'English',
'link' =>
'https://acme.us/welcome'],
886 [
'title' =>
'French',
'link' =>
'https://acme.fr/bienvenue'],
887 [
'title' =>
'Franco-Canadian',
'link' =>
'/bienvenue'],
891 'https://blog.acme.com/',
894 [
'title' =>
'Default',
'link' =>
'/authors']
910 $response = $this->executeFrontendRequest(
911 (
new InternalRequest($hostPrefix))
912 ->withPageId($sourcePageId)
914 $this->createLanguageMenuProcessorInstruction([
915 'languages' =>
'auto',
918 $this->internalRequestContext
921 $json = json_decode((
string)$response->getBody(),
true);
922 $json = $this->filterMenu($json);
924 static::assertSame($expectation, $json);