‪TYPO3CMS  ‪main
TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest:

Public Member Functions

 findByUidOverlayModeOnDefaultLanguage ()
 
 findByUidNoOverlaysDefaultLanguage ()
 
 findByUidOverlayModeOnLanguage ()
 
 findByUidNoOverlaysLanguage ()
 
 customFindByUidOverlayEnabled ()
 
 customFindByUidOverlayDisabled ()
 
 queryFirst5Posts (int $languageUid, string $overlay, array $expected)
 
 queryPostsByProperty (int $languageUid, string $overlay, array $expected)
 
 postsWithoutRespectingSysLanguage (int $languageUid, string $overlay, array $expected)
 

Static Public Member Functions

static queryFirst5PostsDataProvider ()
 
static queryPostsByPropertyDataProvider ()
 
static postsWithoutRespectingSysLanguageDataProvider ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

array $testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example']
 

Private Member Functions

 assertObjectsProperties (array $objects, array $expected)
 

Static Private Member Functions

static mixed getPropertyPath (mixed $subject, string $propertyPath)
 

Private Attributes

PostRepository $postRepository
 
PersistenceManager $persistenceManager
 

Detailed Description

Definition at line 38 of file QueryLocalizedDataTest.php.

Member Function Documentation

◆ assertObjectsProperties()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::assertObjectsProperties ( array  $objects,
array  $expected 
)
private

◆ customFindByUidOverlayDisabled()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::customFindByUidOverlayDisabled ( )

This tests shows what query by uid returns depending on the language, and used uid (default language record or translated record uid). All with overlay mode disabled.

The post with uid 2 is translated to language 1, and there has uid 11.

Definition at line 310 of file QueryLocalizedDataTest.php.

References TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_OFF, and TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\PROPERTY_LOCALIZED_UID.

◆ customFindByUidOverlayEnabled()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::customFindByUidOverlayEnabled ( )

This tests shows what query by uid returns depending on the language, and used uid (default language record or translated record uid). All with overlay mode enabled.

The post with uid 2 is translated to language 1, and there has uid 11.

Definition at line 235 of file QueryLocalizedDataTest.php.

References TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON, and TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\PROPERTY_LOCALIZED_UID.

◆ findByUidNoOverlaysDefaultLanguage()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::findByUidNoOverlaysDefaultLanguage ( )

◆ findByUidNoOverlaysLanguage()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::findByUidNoOverlaysLanguage ( )

◆ findByUidOverlayModeOnDefaultLanguage()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::findByUidOverlayModeOnDefaultLanguage ( )

Test in default language

With overlays enabled it doesn't make a difference whether you call findByUid with translated record uid or default language record uid.

Note that with feature flag disabled, you'll get same result (not translated record) for both calls ->findByUid(2) and ->findByUid(11)

Definition at line 74 of file QueryLocalizedDataTest.php.

References TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON, and TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\PROPERTY_LOCALIZED_UID.

◆ findByUidOverlayModeOnLanguage()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::findByUidOverlayModeOnLanguage ( )

◆ getPropertyPath()

static mixed TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::getPropertyPath ( mixed  $subject,
string  $propertyPath 
)
staticprivate

This is a copy of the ObjectAccess::getPropertyPath, but with the fallback to access protected properties, and iterator_to_array added.

Parameters
mixed$subject‪Object or array to get the property path from
Returns
‪mixed Value of the property

Definition at line 1130 of file QueryLocalizedDataTest.php.

References TYPO3\CMS\Extbase\Reflection\ObjectAccess\getPropertyInternal().

Referenced by TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\assertObjectsProperties().

◆ postsWithoutRespectingSysLanguage()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::postsWithoutRespectingSysLanguage ( int  $languageUid,
string  $overlay,
array  $expected 
)

This test demonstrates how query behaves when setRespectSysLanguage is set to false. The test now documents the WRONG behaviour described in https://forge.typo3.org/issues/45873.

The expected state is that when setRespectSysLanguage is false, then both: default language record, and translated language record should be returned. Regardless of the language setting or the overlay mode. Now we're getting same record twice in some cases.

Definition at line 1084 of file QueryLocalizedDataTest.php.

References TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\assertObjectsProperties(), and TYPO3\CMS\Extbase\Persistence\QueryInterface\ORDER_ASCENDING.

◆ postsWithoutRespectingSysLanguageDataProvider()

static TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::postsWithoutRespectingSysLanguageDataProvider ( )
static

◆ queryFirst5Posts()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::queryFirst5Posts ( int  $languageUid,
string  $overlay,
array  $expected 
)

This test check posts returned by repository, when changing language and languageOverlayMode It also sets limit, offset to validate there are no "gaps" in pagination and sorting (on a posts property)

Definition at line 792 of file QueryLocalizedDataTest.php.

References TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\assertObjectsProperties(), and TYPO3\CMS\Extbase\Persistence\QueryInterface\ORDER_ASCENDING.

◆ queryFirst5PostsDataProvider()

◆ queryPostsByProperty()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::queryPostsByProperty ( int  $languageUid,
string  $overlay,
array  $expected 
)

This test check posts returned by repository, when filtering by property

"Post 6" is not translated "Post 5" is translated as "Post 5 - DA" "Post DA only" has no translation parent

Definition at line 1004 of file QueryLocalizedDataTest.php.

References TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\assertObjectsProperties(), and TYPO3\CMS\Extbase\Persistence\QueryInterface\ORDER_ASCENDING.

◆ queryPostsByPropertyDataProvider()

◆ setUp()

TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::setUp ( )
protected

Member Data Documentation

◆ $persistenceManager

PersistenceManager TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::$persistenceManager
private

Definition at line 43 of file QueryLocalizedDataTest.php.

◆ $postRepository

PostRepository TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::$postRepository
private

Definition at line 42 of file QueryLocalizedDataTest.php.

◆ $testExtensionsToLoad

array TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest::$testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example']
protected

Definition at line 40 of file QueryLocalizedDataTest.php.