Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,54 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Framework\DateTime;
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Framework\DateTime\Clock;
|
||||
use App\Framework\Config\AppConfig;
|
||||
use App\Framework\DateTime\ClockInitializer;
|
||||
use App\Framework\DateTime\FrozenClock;
|
||||
use App\Framework\DateTime\SystemClock;
|
||||
use App\Framework\DateTime\SystemTimer;
|
||||
use App\Framework\DateTime\Timezone;
|
||||
|
||||
class ClockInitializerTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testDefaultInitialization(): void
|
||||
{
|
||||
$initializer = new ClockInitializer();
|
||||
$clock = $initializer();
|
||||
beforeEach(function () {
|
||||
$this->config = new AppConfig(
|
||||
timezone: Timezone::UTC
|
||||
);
|
||||
$this->initializer = new ClockInitializer($this->config);
|
||||
});
|
||||
|
||||
$this->assertInstanceOf(SystemClock::class, $clock);
|
||||
$this->assertEquals('UTC', $clock->now()->getTimezone()->getName());
|
||||
}
|
||||
test('default initialization creates system clock with UTC', function () {
|
||||
$clock = ($this->initializer)();
|
||||
|
||||
public function testCustomTimezone(): void
|
||||
{
|
||||
$initializer = new ClockInitializer('Europe/Berlin');
|
||||
$clock = $initializer();
|
||||
expect($clock)->toBeInstanceOf(SystemClock::class)
|
||||
->and($clock->now()->getTimezone()->getName())->toBe('UTC');
|
||||
});
|
||||
|
||||
$this->assertInstanceOf(SystemClock::class, $clock);
|
||||
$this->assertEquals('Europe/Berlin', $clock->now()->getTimezone()->getName());
|
||||
}
|
||||
test('custom timezone in config is respected', function () {
|
||||
$config = new AppConfig(
|
||||
timezone: Timezone::EuropeBerlin
|
||||
);
|
||||
$initializer = new ClockInitializer($config);
|
||||
$clock = $initializer();
|
||||
|
||||
public function testFrozenClockInitialization(): void
|
||||
{
|
||||
$initializer = new ClockInitializer(
|
||||
useFrozenClock: true,
|
||||
frozenTime: '2021-01-01 12:00:00'
|
||||
);
|
||||
$clock = $initializer();
|
||||
expect($clock)->toBeInstanceOf(SystemClock::class)
|
||||
->and($clock->now()->getTimezone()->getName())->toBe('Europe/Berlin');
|
||||
});
|
||||
|
||||
$this->assertInstanceOf(FrozenClock::class, $clock);
|
||||
$this->assertEquals('2021-01-01 12:00:00', $clock->now()->format('Y-m-d H:i:s'));
|
||||
}
|
||||
test('timer initialization works', function () {
|
||||
$timer = $this->initializer->initTimer();
|
||||
|
||||
public function testFrozenClockWithCustomTimezone(): void
|
||||
{
|
||||
$initializer = new ClockInitializer(
|
||||
timezone: 'Europe/Berlin',
|
||||
useFrozenClock: true,
|
||||
frozenTime: '2021-01-01 12:00:00'
|
||||
);
|
||||
$clock = $initializer();
|
||||
|
||||
$this->assertInstanceOf(FrozenClock::class, $clock);
|
||||
$this->assertEquals('Europe/Berlin', $clock->now()->getTimezone()->getName());
|
||||
}
|
||||
}
|
||||
expect($timer)->toBeInstanceOf(SystemTimer::class);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user