Skip to content

Commit

Permalink
show timezone name to debug when there is a collision
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptouuuu committed Nov 23, 2024
1 parent a4ba1b7 commit 775c150
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions tests/ClockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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'],
);
});
}
Expand Down

0 comments on commit 775c150

Please sign in to comment.