getName()); self::assertSame('203.0.113.10', $event->getIpAddress()); self::assertSame(5, $event->getFailureCount()); self::assertSame(300, $event->getWindowSeconds()); self::assertSame('tenant-a', $event->getTenantId()); self::assertSame('5 failed attempts in 300 seconds', $event->getReason()); self::assertSame( ['failureCount' => 5, 'windowSeconds' => 300], $event->getData(), ); self::assertSame(SecurityEventSeverity::CRITICAL, $event->getSeverity()); } #[Test] #[TestDox('Brute-force detection rejects invalid measurements')] public function rejectsInvalidMeasurements(): void { foreach ([ ['', 5, 300], ['203.0.113.10', 0, 300], ['203.0.113.10', 5, 0], ] as $arguments) { try { new BruteForceDetectedEvent(...$arguments); self::fail('Invalid brute-force measurements were accepted.'); } catch (\InvalidArgumentException) { $this->addToAssertionCount(1); } } } }