Skip to content

Commit 76d2e0e

Browse files
committed
OXDEV-9496: Randomize strings and rename "getSut"-method
1 parent 92c36ec commit 76d2e0e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/Unit/Greeting/Service/GreetingMessageServiceTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ final class GreetingMessageServiceTest extends TestCase
2323
public function testGeneralGreeting(): void
2424
{
2525
$shopName = uniqid();
26-
$service = $this->getGreetingMessageService(
26+
$service = $this->getSut(
2727
shopLanguage: $langStub = $this->createStub(CoreLanguage::class),
2828
shopName: $shopName,
2929
);
3030

31-
$translatedString = 'Welcome to shop %s!';
31+
$translatedString = uniqid() . ' %s';
3232
$langStub->method('translateString')
3333
->with(ModuleCore::GENERAL_GREETING_LANGUAGE_CONST)
3434
->willReturn($translatedString);
@@ -38,7 +38,7 @@ public function testGeneralGreeting(): void
3838

3939
public function testGenericGreetingNoUserForGenericMode(): void
4040
{
41-
$service = $this->getGreetingMessageService(
41+
$service = $this->getSut(
4242
moduleSettings: $moduleSettingsStub = $this->createMock(ModuleSettingsServiceInterface::class),
4343
shopLanguage: $langStub = $this->createStub(CoreLanguage::class),
4444
);
@@ -56,7 +56,7 @@ public function testGenericGreetingNoUserForGenericMode(): void
5656

5757
public function testGenericGreetingWithUserForGenericMode(): void
5858
{
59-
$service = $this->getGreetingMessageService(
59+
$service = $this->getSut(
6060
moduleSettings: $moduleSettingsStub = $this->createMock(ModuleSettingsServiceInterface::class),
6161
shopLanguage: $langStub = $this->createStub(CoreLanguage::class),
6262
);
@@ -74,7 +74,7 @@ public function testGenericGreetingWithUserForGenericMode(): void
7474

7575
public function testGenericGreetingNoUserForPersonalMode(): void
7676
{
77-
$service = $this->getGreetingMessageService(
77+
$service = $this->getSut(
7878
moduleSettings: $moduleSettingsStub = $this->createMock(ModuleSettingsServiceInterface::class),
7979
);
8080

@@ -84,7 +84,7 @@ public function testGenericGreetingNoUserForPersonalMode(): void
8484
$this->assertSame('', $service->getGreeting(null));
8585
}
8686

87-
private function getGreetingMessageService(
87+
private function getSut(
8888
?ModuleSettingsServiceInterface $moduleSettings = null,
8989
?CoreRequest $shopRequest = null,
9090
?CoreLanguage $shopLanguage = null,
@@ -94,7 +94,7 @@ private function getGreetingMessageService(
9494
moduleSettings: $moduleSettings ?? $this->createStub(ModuleSettingsServiceInterface::class),
9595
shopRequest: $shopRequest ?? $this->createStub(CoreRequest::class),
9696
shopLanguage: $shopLanguage ?? $this->createStub(CoreLanguage::class),
97-
shopName: $shopName ?? 'Test Shop',
97+
shopName: $shopName ?? uniqid(),
9898
);
9999
}
100100
}

0 commit comments

Comments
 (0)