actingAsHades(); $component = new class { use HasRateLimiting; public string $actionMessage = ''; public string $actionType = ''; public function attempt(): mixed { return $this->rateLimit('platform-test', 2, static fn (): string => 'ok'); } }; RateLimiter::clear('platform-test:1'); $this->assertSame('ok', $component->attempt()); $this->assertSame('ok', $component->attempt()); } public function test_HasRateLimiting_rateLimit_Bad_sets_warning_state_when_limited(): void { $this->actingAsHades(); $component = new class { use HasRateLimiting; public string $actionMessage = ''; public string $actionType = ''; public function attempt(): mixed { return $this->rateLimit('platform-test', 1, static fn (): string => 'ok'); } }; RateLimiter::clear('platform-test:1'); $component->attempt(); $this->assertNull($component->attempt()); $this->assertSame('warning', $component->actionType); $this->assertStringContainsString('Too many platform test attempts', $component->actionMessage); } }