<?php

use objects\subusers_o;

it('accepts subuser passwords that match the shared policy', function (): void {
    subusers_o::assertValidPassword('Test1234');

    expect(true)->toBeTrue();
});

it('rejects subuser passwords that do not match the shared policy', function (string $password): void {
    expect(fn () => subusers_o::assertValidPassword($password))
        ->toThrow(Exception::class, 'Password must be between 8 and 255 characters long');
})->with([
    'too short' => ['Tes123'],
    'missing uppercase' => ['test1234'],
    'missing lowercase' => ['TEST1234'],
    'missing number' => ['TestPassword'],
    'too long' => [str_repeat('A', 256) . 'a1'],
]);
