diff --git a/packages/realtime-compiler/src/ConsoleOutput.php b/packages/realtime-compiler/src/ConsoleOutput.php
index 8e33beebca1..799aa5ae7aa 100644
--- a/packages/realtime-compiler/src/ConsoleOutput.php
+++ b/packages/realtime-compiler/src/ConsoleOutput.php
@@ -24,11 +24,11 @@ public function __construct(bool $verbose = false, ?SymfonyOutput $output = null
$this->output = $output ?? new SymfonyOutput();
}
- public function printStartMessage(string $host, int $port, array $environment): void
+ public function printStartMessage(string $host, int $port, array $environment = []): void
{
$url = sprintf('%s://%s:%d', $port === 443 ? 'https' : 'http', $host, $port);
- $lines = [
+ $lines = Arr::whereNotNull([
'',
sprintf('%s %s', 'HydePHP Realtime Compiler', 'v'.Hyde::getInstance()->version()),
'',
@@ -36,7 +36,7 @@ public function printStartMessage(string $host, int $port, array $environment):
(config('hyde.server.dashboard.enabled') || Arr::has($environment, 'HYDE_SERVER_DASHBOARD')) && Arr::get($environment, 'HYDE_SERVER_DASHBOARD') === 'enabled' ?
sprintf('Live dashboard: %s/dashboard', $url, $url) : null,
'',
- ];
+ ]);
$lineLength = max(array_map('strlen', array_map('strip_tags', $lines)));
diff --git a/packages/realtime-compiler/tests/ConsoleOutputTest.php b/packages/realtime-compiler/tests/ConsoleOutputTest.php
index bc201767aef..16c1e8a274c 100644
--- a/packages/realtime-compiler/tests/ConsoleOutputTest.php
+++ b/packages/realtime-compiler/tests/ConsoleOutputTest.php
@@ -6,8 +6,12 @@
use function Termwind\{renderUsing};
+uses(\Hyde\Testing\UnitTestCase::class);
+
beforeEach(function () {
renderUsing($this->output = new BufferedOutput());
+
+ $this::mockConfig();
});
afterEach(function () {
@@ -31,13 +35,13 @@ public static function version(): string
$output->printStartMessage('localhost', 8000);
$this->assertSame(<<<'TXT'
- ╭────────────────────────────────────╮
- │ │
- │ HydePHP Realtime Compiler v1.2.3 │
- │ │
- │ Listening on http://localhost:8000 │
- │ │
- ╰────────────────────────────────────╯
+ ╭─────────────────────────────────────╮
+ │ │
+ │ HydePHP Realtime Compiler v1.2.3 │
+ │ │
+ │ Listening on: http://localhost:8000 │
+ │ │
+ ╰─────────────────────────────────────╯
TXT, str_replace(["\u{A0}", "\r"], [' ', ''], $this->output->fetch()));