packages/sql-semantics-mysql/tests/Unit/Statement/Account/Option/AccountOptionKindTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Account\Option;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Statement\Account\Option\AccountOptionKind;
11
12#[CoversClass(AccountOptionKind::class)]
13#[Small]
14final class AccountOptionKindTest extends TestCase
15{
16 public function testWordsSpellEveryOption(): void
17 {
18 self::assertSame(['PASSWORD', 'REQUIRE', 'CURRENT', 'OPTIONAL'], AccountOptionKind::RequireCurrentOptional->words());
19 self::assertSame(['PASSWORD_LOCK_TIME'], AccountOptionKind::LockTime->words());
20 }
21
22 public function testNumberedTellsTheOptionsWithANumber(): void
23 {
24 self::assertSame(['ExpireInterval', 'HistoryCount', 'ReuseInterval', 'FailedLoginAttempts', 'LockTime'], array_column(array_values(array_filter(AccountOptionKind::cases(), static fn (AccountOptionKind $kind): bool => $kind->numbered())), 'name'));
25 }
26
27 public function testUnitIsDayForTheIntervals(): void
28 {
29 self::assertSame(['DAY', null], [AccountOptionKind::ExpireInterval->unit(), AccountOptionKind::HistoryCount->unit()]);
30 }
31}
32