Commit e6e816cc authored by Stefan Bürk's avatar Stefan Bürk Committed by Oliver Bartsch
Browse files

[TASK] Cover FE index.php id/type parameter requests with tests

Core has been working with id and type as query
parameter to display FE pages and switch between
defined TypoScript page definitions. Speaking url
has been integrated for v9 through the new routing
feature to do it in a more determistic way as in
comparision to ext:realurl.

As there might be instances using id/type query
parameters for ajax call switches (and eventelly
for eid scrips) in the frontend, normalization has
been implemented to keep this option alive (#88028).

Recently there has been a try to fix a bug for so
some use cases, which broke this support (#94537).

For future it should be considered if it is possible
to drop this option in the future to free id/type
query arguments for instances in the frontend.

There a several issues in this area, for example
broken subfolder installation support and id/type
query parameter on a full speaking url overrule
it with selected id, which is not expected.

To validate that the test fails if support is
broken change in PageRouter following line (150):

$urlPath = str_replace($scriptName, '', $urlPath);

to

$urlPath = str_replace( '/' . $scriptName,
    '', $urlPath);

Build/Scripts/runTests.sh -s functional \
typo3/sysext/frontend/Tests/Functional/SiteHandling/\
SiteRequestTest.php

This patch acts as pre-patche to fix these.

Resolves: #95096
Related: #95096
Releases: master, 10.4
Change-Id: Iff97f04d7bf7e7b2462425d830e0451a8d7a8686
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70880

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
parent 39d86ee8
......@@ -774,4 +774,53 @@ class SiteRequestTest extends AbstractTestCase
$responseStructure->getScopePath('getpost/testing.value')
);
}
/**
* @return array
*/
public function checkIfIndexPhpReturnsShortcutRedirectWithPageIdAndTypeNumProvidedDataProvider(): array
{
$domainPaths = [
'https://website.local/',
'https://website.local/index.php',
];
$queries = [
'',
'?id=1000',
'?type=0',
'?id=1000&type=0',
];
return $this->wrapInArray(
$this->keysFromValues(
PermutationUtility::meltStringItems([$domainPaths, $queries])
)
);
}
/**
* @param string $uri
*
* @test
* @dataProvider checkIfIndexPhpReturnsShortcutRedirectWithPageIdAndTypeNumProvidedDataProvider
*/
public function checkIfIndexPhpReturnsShortcutRedirectWithPageIdAndTypeNumProvided(string $uri)
{
$this->writeSiteConfiguration(
'website-local',
$this->buildSiteConfiguration(1000, 'https://website.local/')
);
$expectedStatusCode = 307;
$expectedHeaders = ['X-Redirect-By' => ['TYPO3 Shortcut/Mountpoint'], 'location' => ['https://website.local/en-welcome']];
$response = $this->executeFrontendSubRequest(
new InternalRequest($uri),
$this->internalRequestContext
);
self::assertSame($expectedStatusCode, $response->getStatusCode());
self::assertSame($expectedHeaders, $response->getHeaders());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment