invoke(null, $password, $password2, $required, $email); } public function testRequiresPasswordWhenRequired(): void { $errors = $this->validate('', '', true, 'test@example.com'); $this->assertNotEmpty($errors); } public function testRejectsMismatch(): void { $errors = $this->validate('Abcd1234$efg', 'Abcd1234$xxx', true, 'test@example.com'); $this->assertNotEmpty($errors); } public function testAcceptsStrongPassword(): void { $errors = $this->validate('StrongPass1!', 'StrongPass1!', true, 'test@example.com'); $this->assertSame([], $errors); } public function testRejectsPasswordContainingEmail(): void { $errors = $this->validate('test@example.comA1!', 'test@example.comA1!', true, 'test@example.com'); $this->assertNotEmpty($errors); } }