‪TYPO3CMS  ‪main
LinkHandlingController.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 Psr\Http\Message\ServerRequestInterface;
24 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\ArrayValueInstruction;
25 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
26 
31 {
33 
38  {
39  $this->cObj = ‪$cObj;
40  }
41 
42  public function ‪mainAction(mixed $_, array $__, ServerRequestInterface $request): string
43  {
44  if (!$request instanceof InternalRequest) {
45  throw new \RuntimeException(
46  'LinkHandlingController test fixture must receive a testing framework InternalRequest',
47  1664968186
48  );
49  }
50  $instruction = $request->getInstruction(LinkHandlingController::class);
51  if (!$instruction instanceof ArrayValueInstruction) {
52  return '';
53  }
54  return $this->cObj->cObjGet($instruction->getArray());
55  }
56 
60  public function ‪dumpPageArgumentsAction(?string $content, array $configuration = null): string
61  {
63  $request = ‪$GLOBALS['TYPO3_REQUEST'];
65  $pageArguments = $request->getAttribute('routing');
67  $language = $request->getAttribute('language');
68  $flags = 0;
69  if ($configuration['userFunc.']['prettyPrint'] ?? true) {
70  $flags += JSON_PRETTY_PRINT;
71  }
72  return json_encode([
73  'pageId' => $pageArguments->getPageId(),
74  'pageType' => $pageArguments->getPageType(),
75  'languageId' => $language->getLanguageId(),
76  'staticArguments' => $pageArguments->getStaticArguments(),
77  'routeArguments' => $pageArguments->getRouteArguments(),
78  'dynamicArguments' => $pageArguments->getDynamicArguments(),
79  'queryArguments' => $pageArguments->getQueryArguments(),
80  'requestQueryParams' => $request->getQueryParams(),
81  '_GET' => $_GET,
82  ], $flags);
83  }
84 }
‪TYPO3\CMS\Core\Routing\PageArguments
Definition: PageArguments.php:26
‪TYPO3\CMS\Core\Site\Entity\SiteLanguage
Definition: SiteLanguage.php:27
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:102
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Fixtures
Definition: LinkHandlingController.php:18