Show destination flags and readable shipment dates
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 28s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Hickmeister
2026-10-11 19:24:22 +01:00
co-authored by Claude Sonnet 5.5
parent 6cc2f2c3cc
commit f7e3c8fe16
4 changed files with 153 additions and 4 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Tests\Unit;
use App\Services\Display;
use Tests\TestCase;
class DisplayTest extends TestCase
{
public function test_country_code_accepts_alpha_3_alpha_2_and_names(): void
{
$display = new Display;
$this->assertSame('GB', $display->countryCode(['CountryIsoCode' => 'GBR']));
$this->assertSame('DE', $display->countryCode(['CountryIsoCode' => 'de']));
$this->assertSame('GB', $display->countryCode(['Country' => 'United Kingdom']));
$this->assertNull($display->countryCode(['CountryIsoCode' => 'ZZZZ']));
$this->assertNull($display->countryCode([]));
}
public function test_flag_renders_image_or_dash(): void
{
$display = new Display;
$this->assertStringContainsString('flagcdn.com/w40/fr.png', (string) $display->flag(['CountryIsoCode' => 'FRA']));
$this->assertStringContainsString('—', (string) $display->flag([]));
}
public function test_date_times_are_readable_and_drop_midnight(): void
{
$display = new Display;
$this->assertSame('Thu 8 Oct 2026', $display->dateTime('2026-10-08T00:00:00'));
$this->assertSame('Thu 8 Oct 2026, 14:30', $display->dateTime('2026-10-08T14:30:00'));
$this->assertSame('—', $display->dateTime(null));
$this->assertSame('not a date', $display->dateTime('not a date'));
}
}