From 292678375c62cf6b420f3d067f4e72087abf328e Mon Sep 17 00:00:00 2001 From: Natan Felles Date: Sun, 2 Oct 2022 15:00:49 -0300 Subject: [PATCH] Show host and port in header of EmailCollector --- src/Debug/EmailCollector.php | 12 ++++++++++++ tests/Debug/EmailCollectorTest.php | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Debug/EmailCollector.php b/src/Debug/EmailCollector.php index 3a0a9dd..5d740f6 100644 --- a/src/Debug/EmailCollector.php +++ b/src/Debug/EmailCollector.php @@ -51,6 +51,7 @@ public function getContents() : string echo '

This collector has not been added to a Mailer instance.

'; return \ob_get_clean(); // @phpstan-ignore-line } + echo $this->showHeader(); if ( ! $this->hasData()) { echo '

No messages have been sent.

'; return \ob_get_clean(); // @phpstan-ignore-line @@ -139,4 +140,15 @@ public function getContents() : string endforeach; return \ob_get_clean(); // @phpstan-ignore-line } + + protected function showHeader() : string + { + \ob_start(); + $configs = $this->mailer->getConfigs(); + ?> +

Host:

+

Port:

+ makeMailer(); + $contents = $this->collector->getContents(); + self::assertStringContainsString('Host:', $contents); + self::assertStringContainsString('Port:', $contents); + } + public function testMessagesSent() : void { $message = new Message();