From 775c15097fde506d41e2a2c07602e4beb06748dd Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:10:34 +0100 Subject: [PATCH] show timezone name to debug when there is a collision --- tests/ClockTest.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index bb14d66..b7d963d 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -101,20 +101,32 @@ public function testFrozenClockDoesntChangeItsTimezone() public function testLoggerUseNewTimezone() { + $gen = static function($zones) { + $zones = \iterator_to_array($zones); + + return Set\Elements::of( + ...\array_map( + static fn($name, $switch) => [$name, $switch[0]], + \array_keys($zones), + \array_values($zones), + ), + ); + }; + $this ->forAll( - Set\Elements::of(...\array_values(\iterator_to_array(self::america()))) - ->map(static fn($switch) => $switch[0]), + $gen(self::america()), Set\Either::any( - Set\Elements::of(...\array_values(\iterator_to_array(self::africa()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::europe()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::indian()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::asia()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::australia()))), - ) - ->map(static fn($switch) => $switch[0]), + $gen(self::africa()), + $gen(self::europe()), + $gen(self::indian()), + $gen(self::asia()), + $gen(self::australia()), + ), ) ->then(function($america, $other) { + $america = $america[1]; + $other = $other[1]; $gather = new class implements LoggerInterface { use LoggerTrait; @@ -142,6 +154,7 @@ public function log($level, string|\Stringable $message, array $context = []): v $this->assertNotSame( $gather->logs[0], $gather->logs[1], + $gather->logs[0]['point'], ); }); }