Skip to content

Commit 3109c3b

Browse files
committed
feature #51276 [Notifier] Transport possible to have null (StaffNowa)
This PR was merged into the 6.4 branch. Discussion ---------- [Notifier] Transport possible to have null | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #51236 | License | MIT My test example of why I need to have properly transport null ```php public function testSmsSending(): void { $date = (new \DateTimeImmutable())->format('Y-m-d'); $stateta = new Stateta(); $stateta->setDate(new \DateTimeImmutable($date)); $stateta->setA95(0); $stateta->setDk(0); $this->entityManager->persist($stateta); $this->entityManager->flush(); $this->commandTester->execute([], [ 'verbosity' => OutputInterface::VERBOSITY_DEBUG ]); $this->commandTester->assertCommandIsSuccessful(); $notifierEvent = $this->getNotifierEvent(); self::assertEquals(null, $notifierEvent->getMessage()->getTransport()); self::assertEquals("+37061234567", $notifierEvent->getMessage()->getRecipientId()); self::assertNotificationIsQueued($notifierEvent); self::assertNotificationSubjectContains($notifierEvent->getMessage(), 'Company name'); self::assertNotificationTransportIsEqual($notifierEvent->getMessage(), null); } ``` Commits ------- 6120c4bd88 [Notifier] Transport possible to have null
2 parents c988179 + 6fea7ec commit 3109c3b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Message/NullMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ public function getOptions(): ?MessageOptionsInterface
4040

4141
public function getTransport(): ?string
4242
{
43-
return $this->decoratedMessage->getTransport() ?? 'null';
43+
return $this->decoratedMessage->getTransport() ?? null;
4444
}
4545
}

Test/Constraint/NotificationTransportIsEqual.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
*/
2020
final class NotificationTransportIsEqual extends Constraint
2121
{
22-
private string $expectedText;
22+
private ?string $expectedText;
2323

24-
public function __construct(string $expectedText)
24+
public function __construct(?string $expectedText)
2525
{
2626
$this->expectedText = $expectedText;
2727
}

0 commit comments

Comments
 (0)