‪TYPO3CMS  10.4
TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest:
TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait

Public Member Functions

 onlyEnglishContentIsRenderedForDefaultLanguage ()
 
array dutchDataProvider ()
 
 renderingOfDutchLanguage (array $languageConfiguration, array $visibleRecords, string $fallbackType, string $fallbackChain, string $overlayType)
 
 contentOnNonTranslatedPageDataProvider ()
 
 contentOnNonTranslatedPageGerman (array $languageConfiguration, array $visibleRecords, string $pageTitle, int $languageId, int $contentLanguageId, string $fallbackType, string $fallbackChain, string $overlayMode, int $statusCode=200)
 
 contentOnPartiallyTranslatedPageDataProvider ()
 
 contentOnPartiallyTranslatedPage (array $languageConfiguration, array $visibleHeaders, string $fallbackType, string $fallbackChain, string $overlayType)
 

Public Attributes

const VALUE_PageId = 89
 
const TABLE_Content = 'tt_content'
 
const TABLE_Pages = 'pages'
 
- ‪Public Attributes inherited from ‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
const VALUE_BackendUserId = 1
 

Protected Member Functions

 setUp ()
 
array getNonVisibleHeaders (array $visibleHeaders)
 
array getNonVisibleFileTitles (array $visibleTitles)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
 tearDown ()
 
 setUpFrontendSite (int $pageId, array $additionalLanguages=[])
 
 setWorkspaceId (int $workspaceId)
 
ActionService getActionService ()
 
 importScenarioDataSet ($dataSetName)
 
 assertAssertionDataSet ($dataSetName)
 
 assertErrorLogEntries (array $expectedMessages=null)
 
 assertCleanReferenceIndex ()
 
HasRecordConstraint getRequestSectionHasRecordConstraint ()
 
DoesNotHaveRecordConstraint getRequestSectionDoesNotHaveRecordConstraint ()
 
StructureHasRecordConstraint getRequestSectionStructureHasRecordConstraint ()
 
StructureDoesNotHaveRecordConstraint getRequestSectionStructureDoesNotHaveRecordConstraint ()
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
 writeSiteConfiguration (string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
 
 mergeSiteConfiguration (string $identifier, array $overrides)
 
array buildSiteConfiguration (int $rootPageId, string $base='')
 
array buildDefaultLanguageConfiguration (string $identifier, string $base)
 
array buildLanguageConfiguration (string $identifier, string $base, array $fallbackIdentifiers=[], string $fallbackType=null)
 
array buildErrorHandlingConfiguration (string $handler, array $codes)
 
mixed resolveLanguagePreset (string $identifier)
 
InternalRequest applyInstructions (InternalRequest $request, AbstractInstruction ... $instructions)
 
AbstractInstruction mergeInstruction (AbstractInstruction $current, AbstractInstruction $other)
 

Protected Attributes

string $scenarioDataSetDirectory = 'typo3/sysext/frontend/Tests/Functional/Rendering/DataSet/'
 
string[] $coreExtensionsToLoad = array( 'frontend', 'workspaces' )
 
array $pathsToLinkInTestInstance
 
int null $expectedErrorLogEntries
 
const LANGUAGE_PRESETS
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
bool $assertCleanReferenceIndex = true
 
string $scenarioDataSetDirectory
 
string $assertionDataSetDirectory
 
int null $expectedErrorLogEntries = 0
 
array $testExtensionsToLoad
 
array $pathsToLinkInTestInstance
 
array $recordIds = array( )
 
ActionService $actionService
 
TYPO3 CMS Core Authentication BackendUserAuthentication $backendUser
 
array $siteLanguageConfiguration
 

Additional Inherited Members

- ‪Static Protected Member Functions inherited from ‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
static failIfArrayIsNotEmpty (array $items)
 

Detailed Description

Test case checking if localized tt_content is rendered correctly with different language settings with site configuration.

Previously the language was given by TypoScript settings which were overridden via GP parameters for language

config.sys_language_uid = [0,1,2,3,4...] config.sys_language_mode = [strict, content_fallback;2,3, ignore, ''] config.sys_language_overlay = [0, 1, hideNonTranslated]

The previous setting config.sys_language_mode the behaviour of the page translation was referred to, and what should happen if a page translation does not exist.

the setting config.sys_language_overlay was responsible if records of a target language should be fetched directly ("free mode" or no-overlays), or if the default language (L=0) should be taken and then overlaid. In addition the "hideNonTranslated" was a special form of overlays: Take the default language, but if the translation does not exist, do not render the default language.

This is what changed with Site Handling:

  • ‪General approach is now defined on a site language, in configuration, not evaluated during runtime
  • Page fallback concept (also for menu generation) is now valid for page and content.
  • ‪Various options which only made sense on specific page configurations have been removed for consistency reasons.

Pages & Menus:

  • ‪When a Page Translation needs to be fetched, it is checked if the page translation exists, otherwise the "fallbackChain" jumps in and checks if the other languages are available or aren't available.
  • ‪If no fallbackChain is given, then the page is not shown / rendered / accessible.
  • ‪pages.l18n_cfg is now considered properly with multiple fallback languages for menus and page resolving and URL linking.

Content Fetching:

  • ‪A new "free" mode only fetches the records that are set in a specific language. Due to the concept of the database structure, no fallback logic applies currently when selecting records, however fallbackChains are still valid for identifying the Page Translation.
  • ‪The modes "fallback" and "strict" have similarities: They utilize the so-called "overlay" logic: Fetch records in the default language (= 0) and then overlay with the available language. This ensures that ordering and other connections are kept the same way as on the default language.
  • ‪"fallback" shows content in the language of the page that was selected, does the overlays but keeps the default language records when no translation is available (= "mixed overlays").
  • ‪"strict" shows only content of the page that was selected via overlays (fetch default language and do overlays) but does not render the ones that have no translation in the specific language.

General notes regarding content fetching:

  • ‪Records marked as "All Languages" (sys_language_uid = -1) are always fetched (this wasn't always the case before!).
  • ‪Records without a language parent (l10n_parent) are rendered at any time.

Relevant parts for site handling:

SiteLanguage -> languageId the language that is requested, usually determined by the base property. If this setting is "0" no other options are taken into account. -> fallbackType

  • ‪strict:
    • ‪for pages: if the page translation does not exist, check fallbackChain
    • ‪for record fetching: take Default Language records which have a valid translation for this language + records without default translation
  • ‪fallback:
    • ‪for pages: if the page translation does not exist, check fallbackChain
    • ‪for record fetching: take Default Language records and overlay the language, but keep default language records + records without default translation
  • ‪free:
    • ‪for pages: if the page translation does not exist, check fallbackChain
    • ‪for record fetching: Only fetch records of the current language and "All languages" no overlays are done.

LanguageAspect -> doOverlays() whether the the overlay logic should be applied -> getLanguageId() the language that was originally requested -> getContentId() if the page translation for e.g. language=5 is not available, but the fallback is "4,3,2", then the content of this language is used instead. applies to all concepts of fallback types. -> getFallbackChain() if the page is not available in a specific language, apply other language Ids in the given order until the page translation can be found.

Definition at line 99 of file LocalizedSiteContentRenderingTest.php.

Member Function Documentation

◆ contentOnNonTranslatedPageDataProvider()

TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::contentOnNonTranslatedPageDataProvider ( )

Definition at line 377 of file LocalizedSiteContentRenderingTest.php.

◆ contentOnNonTranslatedPageGerman()

TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::contentOnNonTranslatedPageGerman ( array  $languageConfiguration,
array  $visibleRecords,
string  $pageTitle,
int  $languageId,
int  $contentLanguageId,
string  $fallbackType,
string  $fallbackChain,
string  $overlayMode,
int  $statusCode = 200 
)

Page uid 89 is NOT translated to german

Test:
‪@dataProvider contentOnNonTranslatedPageDataProvider
Parameters
array$languageConfiguration
array$visibleRecords
string$pageTitle
int$languageId
int$contentLanguageId
string$fallbackType
string$fallbackChain
string$overlayMode
int$statusCode‪200 or 404

Definition at line 660 of file LocalizedSiteContentRenderingTest.php.

References TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration(), TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildErrorHandlingConfiguration(), TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildLanguageConfiguration(), TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest\getNonVisibleFileTitles(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest\getNonVisibleHeaders(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionDoesNotHaveRecordConstraint(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionHasRecordConstraint(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureDoesNotHaveRecordConstraint(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureHasRecordConstraint(), and TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration().

◆ contentOnPartiallyTranslatedPage()

◆ contentOnPartiallyTranslatedPageDataProvider()

TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::contentOnPartiallyTranslatedPageDataProvider ( )

Definition at line 721 of file LocalizedSiteContentRenderingTest.php.

◆ dutchDataProvider()

array TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::dutchDataProvider ( )

Dutch language has page translation record and some content elements are translated

Returns
‪array

Definition at line 226 of file LocalizedSiteContentRenderingTest.php.

◆ getNonVisibleFileTitles()

array TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::getNonVisibleFileTitles ( array  $visibleTitles)
protected

◆ getNonVisibleHeaders()

◆ onlyEnglishContentIsRenderedForDefaultLanguage()

TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::onlyEnglishContentIsRenderedForDefaultLanguage ( )

◆ renderingOfDutchLanguage()

TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::renderingOfDutchLanguage ( array  $languageConfiguration,
array  $visibleRecords,
string  $fallbackType,
string  $fallbackChain,
string  $overlayType 
)

Page is translated to Dutch, so changing fallbackChain does not matter currently. Page title is always [DK]Page, the content language is always "1"

Test:
‪@dataProvider dutchDataProvider
Parameters
array$languageConfiguration
array$visibleRecords
string$fallbackType
string$fallbackChain
string$overlayType

Definition at line 319 of file LocalizedSiteContentRenderingTest.php.

References TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration(), TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildErrorHandlingConfiguration(), TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildLanguageConfiguration(), TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest\getNonVisibleFileTitles(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest\getNonVisibleHeaders(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionDoesNotHaveRecordConstraint(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionHasRecordConstraint(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureDoesNotHaveRecordConstraint(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionStructureHasRecordConstraint(), and TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration().

◆ setUp()

TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::setUp ( )
protected

Member Data Documentation

◆ $coreExtensionsToLoad

string [] TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::$coreExtensionsToLoad = array( 'frontend', 'workspaces' )
protected

Definition at line 112 of file LocalizedSiteContentRenderingTest.php.

◆ $expectedErrorLogEntries

int null TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::$expectedErrorLogEntries
protected

If this value is NULL, log entries are not considered. If it's an integer value, the number of log entries is asserted.

Definition at line 126 of file LocalizedSiteContentRenderingTest.php.

◆ $pathsToLinkInTestInstance

array TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::$pathsToLinkInTestInstance
protected
Initial value:
= array(
'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/AdditionalConfiguration.php' => 'typo3conf/AdditionalConfiguration.php',
'typo3/sysext/frontend/Tests/Functional/Fixtures/Images' => 'fileadmin/user_upload'
)

Definition at line 116 of file LocalizedSiteContentRenderingTest.php.

◆ $scenarioDataSetDirectory

string TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::$scenarioDataSetDirectory = 'typo3/sysext/frontend/Tests/Functional/Rendering/DataSet/'
protected

Definition at line 108 of file LocalizedSiteContentRenderingTest.php.

◆ LANGUAGE_PRESETS

const TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::LANGUAGE_PRESETS
protected
Initial value:
= [
'EN' => ['id' => 0, 'title' => 'English', 'locale' => 'en_US.UTF8'],
'DK' => ['id' => 1, 'title' => 'Dansk', 'locale' => 'dk_DA.UTF8'],
'DE' => ['id' => 2, 'title' => 'Deutsch', 'locale' => 'de_DE.UTF8'],
'PL' => ['id' => 3, 'title' => 'Polski', 'locale' => 'pl_PL.UTF8'],
]

Definition at line 131 of file LocalizedSiteContentRenderingTest.php.

◆ TABLE_Content

const TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::TABLE_Content = 'tt_content'

Definition at line 103 of file LocalizedSiteContentRenderingTest.php.

◆ TABLE_Pages

const TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::TABLE_Pages = 'pages'

Definition at line 104 of file LocalizedSiteContentRenderingTest.php.

◆ VALUE_PageId

const TYPO3\CMS\Frontend\Tests\Functional\Rendering\LocalizedSiteContentRenderingTest::VALUE_PageId = 89

Definition at line 102 of file LocalizedSiteContentRenderingTest.php.