‪TYPO3CMS  ‪main
TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest Class Reference
Inheritance diagram for TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest:

Public Member Functions

 rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirects ()
 
 rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsForRootChange ()
 
 rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithSubFolderBase ()
 
 rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguages ()
 
 rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesInSubFolder ()
 
 rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithDefaultLanguageInSubFolder ()
 
 rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesForSiteroot ()
 
 modifyAutoCreateRedirectRecordBeforePersistingIsTriggered ()
 
 afterAutoCreteRedirectHasBeenPersistedIsTriggered ()
 
 sysFolderWithSubPagesDoesNotCreateAutoRedirectForSysFolderButUpdatesSubpagesIfReasonable ()
 
 spacerWithSubPagesDoesNotCreateAutoRedirectForSpacerButUpdatesSubpagesIfReasonable ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 buildBaseSite ()
 
 buildBaseSiteInSubfolder ()
 
 buildBaseSiteWithLanguages ()
 
 buildBaseSiteWithLanguagesInSubFolder ()
 
 createSubject ()
 
 assertSlugsAndRedirectsExists (array $slugs, array $redirects, bool $withRedirectUid=false)
 
 setPageSlug (int $pageId, string $slug)
 

Protected Attributes

array $coreExtensionsToLoad = ['redirects']
 

Private Attributes

SlugService $subject
 
CorrelationId $correlationId
 
array $languages
 

Detailed Description

Todo:
Tests in this TestCase simulates what happens in the corresponding DataHandlerSlugUpdateHook, mainly which is executed in which order. This is somehow clumsy. Either cover proper DataHandler hook execution with additional tests avoiding the simulation and testing SlugService in indirect way - or refactor them here.

Definition at line 47 of file SlugServiceTest.php.

Member Function Documentation

◆ afterAutoCreteRedirectHasBeenPersistedIsTriggered()

◆ assertSlugsAndRedirectsExists()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::assertSlugsAndRedirectsExists ( array  $slugs,
array  $redirects,
bool  $withRedirectUid = false 
)
protected

Definition at line 622 of file SlugServiceTest.php.

References TYPO3\CMS\Webhooks\Message\$record.

Referenced by TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\afterAutoCreteRedirectHasBeenPersistedIsTriggered(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\modifyAutoCreateRedirectRecordBeforePersistingIsTriggered(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirects(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsForRootChange(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithDefaultLanguageInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguages(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesForSiteroot(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithSubFolderBase(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\spacerWithSubPagesDoesNotCreateAutoRedirectForSpacerButUpdatesSubpagesIfReasonable(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\sysFolderWithSubPagesDoesNotCreateAutoRedirectForSysFolderButUpdatesSubpagesIfReasonable().

◆ buildBaseSite()

◆ buildBaseSiteInSubfolder()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::buildBaseSiteInSubfolder ( )
protected

◆ buildBaseSiteWithLanguages()

◆ buildBaseSiteWithLanguagesInSubFolder()

◆ createSubject()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::createSubject ( )
protected

Definition at line 607 of file SlugServiceTest.php.

Referenced by TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\afterAutoCreteRedirectHasBeenPersistedIsTriggered(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\modifyAutoCreateRedirectRecordBeforePersistingIsTriggered(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirects(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsForRootChange(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithDefaultLanguageInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguages(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesForSiteroot(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithSubFolderBase(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\spacerWithSubPagesDoesNotCreateAutoRedirectForSpacerButUpdatesSubpagesIfReasonable(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\sysFolderWithSubPagesDoesNotCreateAutoRedirectForSysFolderButUpdatesSubpagesIfReasonable().

◆ modifyAutoCreateRedirectRecordBeforePersistingIsTriggered()

◆ rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirects()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirects ( )

This test should prove, that a renaming of a subtree works as expected and all slugs of sub pages are renamed and redirects are created.

We test here that rebuildSlugsForSlugChange works for a partial tree.

Definition at line 111 of file SlugServiceTest.php.

References TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\assertSlugsAndRedirectsExists(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSite(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\createSubject(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\setPageSlug().

◆ rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsForRootChange()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsForRootChange ( )

This test should prove, that a renaming of a complete tree works as expected and all slugs of sub pages are renamed and redirects are created.

We test here that rebuildSlugsForSlugChange works for a complete tree inclusive the root page.

Definition at line 154 of file SlugServiceTest.php.

References TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\assertSlugsAndRedirectsExists(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSite(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\createSubject(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\setPageSlug().

◆ rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithDefaultLanguageInSubFolder()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithDefaultLanguageInSubFolder ( )

This test should prove, that a renaming of a subtree works as expected and all slugs of sub-pages are renamed and redirects are created.

We test here that rebuildSlugsForSlugChange works with languages and a base in a sub-folder.

Definition at line 332 of file SlugServiceTest.php.

References TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\assertSlugsAndRedirectsExists(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSiteWithLanguagesInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\createSubject(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\setPageSlug().

◆ rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguages()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguages ( )

This test should prove, that a renaming of a subtree works as expected and all slugs of sub-pages are renamed and redirects are created.

We test here that rebuildSlugsForSlugChange works for a setup with languages.

Definition at line 246 of file SlugServiceTest.php.

References TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\assertSlugsAndRedirectsExists(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSiteWithLanguages(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\createSubject(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\setPageSlug().

◆ rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesForSiteroot()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesForSiteroot ( )

This test should prove, that a renaming of a subtree works as expected and all slugs of sub-pages are renamed and redirects are created.

We test here that rebuildSlugsForSlugChange works when changing a L>0 siteroot which has pid=0

Definition at line 376 of file SlugServiceTest.php.

References TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\assertSlugsAndRedirectsExists(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSiteWithLanguages(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\createSubject(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\setPageSlug().

◆ rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesInSubFolder()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesInSubFolder ( )

This test should prove, that a renaming of a subtree works as expected and all slugs of sub-pages are renamed and redirects are created.

We test here that rebuildSlugsForSlugChange works with languages and a base in a sub-folder.

Definition at line 289 of file SlugServiceTest.php.

References TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\assertSlugsAndRedirectsExists(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSiteWithLanguagesInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\createSubject(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\setPageSlug().

◆ rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithSubFolderBase()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithSubFolderBase ( )

This test should prove, that a renaming of a subtree works as expected and all slugs of sub pages are renamed and redirects are created.

We test here that rebuildSlugsForSlugChange works for a setup with a base in a sub-folder.

Definition at line 203 of file SlugServiceTest.php.

References TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\assertSlugsAndRedirectsExists(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSiteInSubfolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\createSubject(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\setPageSlug().

◆ setPageSlug()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::setPageSlug ( int  $pageId,
string  $slug 
)
protected

Definition at line 650 of file SlugServiceTest.php.

Referenced by TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\afterAutoCreteRedirectHasBeenPersistedIsTriggered(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\modifyAutoCreateRedirectRecordBeforePersistingIsTriggered(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirects(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsForRootChange(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithDefaultLanguageInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguages(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesForSiteroot(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithLanguagesInSubFolder(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\rebuildSlugsForSlugChangeRenamesSubSlugsAndCreatesRedirectsWithSubFolderBase(), TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\spacerWithSubPagesDoesNotCreateAutoRedirectForSpacerButUpdatesSubpagesIfReasonable(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\sysFolderWithSubPagesDoesNotCreateAutoRedirectForSysFolderButUpdatesSubpagesIfReasonable().

◆ setUp()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::setUp ( )
protected

◆ spacerWithSubPagesDoesNotCreateAutoRedirectForSpacerButUpdatesSubpagesIfReasonable()

◆ sysFolderWithSubPagesDoesNotCreateAutoRedirectForSysFolderButUpdatesSubpagesIfReasonable()

◆ tearDown()

TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::tearDown ( )
protected

Definition at line 98 of file SlugServiceTest.php.

Member Data Documentation

◆ $coreExtensionsToLoad

array TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::$coreExtensionsToLoad = ['redirects']
protected

Definition at line 87 of file SlugServiceTest.php.

◆ $correlationId

CorrelationId TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::$correlationId
private

Definition at line 55 of file SlugServiceTest.php.

◆ $languages

array TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::$languages
private
Initial value:
= [
[
'title' => 'English',
'enabled' => true,
'languageId' => '0',
'base' => '/en/',
'locale' => 'en_US.UTF-8',
'navigationTitle' => 'English',
'flag' => 'us',
],
[
'title' => 'German',
'enabled' => true,
'languageId' => '1',
'base' => 'https:
'locale' => 'de_DE.UTF-8',
'navigationTitle' => 'German',
'flag' => 'de',
],
[
'title' => 'Spanish',
'enabled' => true,
'languageId' => '2',
'base' => '/es/',
'locale' => 'es_ES.UTF-8',
'navigationTitle' => 'Spanish',
'flag' => 'es',
],
]

Definition at line 57 of file SlugServiceTest.php.

Referenced by TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSiteWithLanguages(), and TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest\buildBaseSiteWithLanguagesInSubFolder().

◆ $subject

SlugService TYPO3\CMS\Redirects\Tests\Functional\Service\SlugServiceTest::$subject
private

Definition at line 51 of file SlugServiceTest.php.