Skip to content

Commit

Permalink
[TASK] Reduce data duplication in some test code (#3729)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverklee authored Sep 27, 2024
1 parent 334858a commit 43295b4
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
*/
class GenerateEventSlugsUpgradeWizardTest extends FunctionalTestCase
{
/**
* @var non-empty-string
*/
private const FIXTURES_PREFIX = __DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/';

protected array $testExtensionsToLoad = [
'typo3conf/ext/static_info_tables',
'typo3conf/ext/feuserextrafields',
Expand Down Expand Up @@ -42,7 +47,7 @@ public function updateNecessaryForEmptyDatabaseReturnsFalse(): void
*/
public function updateNecessaryForOnlyEventsWithSlugsReturnsFalse(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/EventWithSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'EventWithSlug.xml');

self::assertFalse($this->subject->updateNecessary());
}
Expand All @@ -52,7 +57,7 @@ public function updateNecessaryForOnlyEventsWithSlugsReturnsFalse(): void
*/
public function updateNecessaryForEventWithEmptySlugReturnsTrue(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/EventsWithAndWithEmptySlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'EventsWithAndWithEmptySlug.xml');

self::assertTrue($this->subject->updateNecessary());
}
Expand All @@ -62,7 +67,7 @@ public function updateNecessaryForEventWithEmptySlugReturnsTrue(): void
*/
public function updateNecessaryForEventWithNullSlugReturnsTrue(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/EventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'EventWithNullSlug.xml');

self::assertTrue($this->subject->updateNecessary());
}
Expand All @@ -72,7 +77,7 @@ public function updateNecessaryForEventWithNullSlugReturnsTrue(): void
*/
public function updateNecessaryForHiddenEventWithNullSlugReturnsTrue(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/HiddenEventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'HiddenEventWithNullSlug.xml');

self::assertTrue($this->subject->updateNecessary());
}
Expand All @@ -82,7 +87,7 @@ public function updateNecessaryForHiddenEventWithNullSlugReturnsTrue(): void
*/
public function updateNecessaryForDeletedEventWithNullSlugReturnsTrue(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/DeletedEventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'DeletedEventWithNullSlug.xml');

self::assertTrue($this->subject->updateNecessary());
}
Expand All @@ -92,7 +97,7 @@ public function updateNecessaryForDeletedEventWithNullSlugReturnsTrue(): void
*/
public function updateNecessaryForTimedEventWithNullSlugReturnsTrue(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/TimedEventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'TimedEventWithNullSlug.xml');

self::assertTrue($this->subject->updateNecessary());
}
Expand All @@ -102,7 +107,7 @@ public function updateNecessaryForTimedEventWithNullSlugReturnsTrue(): void
*/
public function executeUpdateKeepsEventWithSlugUnmodified(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/EventsWithAndWithEmptySlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'EventsWithAndWithEmptySlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand All @@ -120,7 +125,7 @@ public function executeUpdateKeepsEventWithSlugUnmodified(): void
*/
public function executeUpdateUpdatesSlugOfEventWithEmptySlug(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/EventsWithAndWithEmptySlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'EventsWithAndWithEmptySlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand All @@ -138,7 +143,7 @@ public function executeUpdateUpdatesSlugOfEventWithEmptySlug(): void
*/
public function executeUpdateUpdatesSlugOfEventWithNullSlug(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/EventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'EventWithNullSlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand All @@ -156,7 +161,7 @@ public function executeUpdateUpdatesSlugOfEventWithNullSlug(): void
*/
public function executeUpdateUpdatesSlugOfHiddenEventWithNullSlug(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/HiddenEventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'HiddenEventWithNullSlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand All @@ -174,7 +179,7 @@ public function executeUpdateUpdatesSlugOfHiddenEventWithNullSlug(): void
*/
public function executeUpdateUpdatesSlugOfDeletedEventWithNullSlug(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/DeletedEventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'DeletedEventWithNullSlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand All @@ -192,7 +197,7 @@ public function executeUpdateUpdatesSlugOfDeletedEventWithNullSlug(): void
*/
public function executeUpdateUpdatesSlugOfTimedEventWithNullSlug(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/TimedEventWithNullSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'TimedEventWithNullSlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand All @@ -210,7 +215,7 @@ public function executeUpdateUpdatesSlugOfTimedEventWithNullSlug(): void
*/
public function executeSuffixesSlugIfSlugAlreadyExistsBeforeWizard(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/SlugCollisionWithExistingSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'SlugCollisionWithExistingSlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand Down Expand Up @@ -248,7 +253,7 @@ public function executeSuffixesSlugIfCollidingSlugHasJustBeenCreatedByWizard():
*/
public function executeSuffixesSlugWithNextAvailableSuffixIfSuffixAlreadyExists(): void
{
$this->importDataSet(__DIR__ . '/Fixtures/GenerateEventSlugsUpgradeWizard/SlugCollisionWithSuffixedSlug.xml');
$this->importDataSet(self::FIXTURES_PREFIX . 'SlugCollisionWithSuffixedSlug.xml');

$wizardResult = $this->subject->executeUpdate();

Expand Down

0 comments on commit 43295b4

Please sign in to comment.