Commit 6faef18
authored
Replace magic letter codes in `web/tests/Synthesizer.php` with the
project's column-typed backed-enum wrappers per AGENTS.md → "Backed
enums for column-typed fields":
> always pass `$enum->value` (not the enum case itself) so the dba
> plugin and the underlying PDO see the column-typed primitive
Three concrete sites:
- `insertBans()` admin-removed branch: `'U'` / `'D'` literals →
`BanRemoval::Unbanned->value` / `BanRemoval::Deleted->value`.
- `insertComms()` admin-removed branch: `'U'` literal →
`BanRemoval::Unbanned->value`.
- `insertAuditLog()` events table: `'m'` / `'w'` / `'e'` first-column
literals → `LogType::Message->value` / `LogType::Warning->value` /
`LogType::Error->value` (lifted to local variables so the 20-row
events table stays readable + the enum lookup happens once per call).
The change is pure refactor — no RNG draws shifted (the new
`mt_rand(0, 1)` arms still resolve to the same `'U'` / `'D'` strings
via the enum's `->value`), so `Synthesizer::DEFAULT_SEED` reproduces
byte-identical row distributions before / after (verified by re-running
the seeder twice against the dev DB and diffing the resulting RemoveType
+ log.type counts).
Out of scope per the issue body: `comments.type` (would need a new
`CommentType` enum), `demos.demtype` (would need a new `DemoType`
enum), and `bans.type` (`BanType` exists but the seeder uses an
explicit `$isIpOnly` boolean + writes 0 / 1 directly — explicitly
listed under "Out of scope" in the issue).
1 parent 424d6d4 commit 6faef18
1 file changed
Lines changed: 27 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
827 | | - | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
828 | 830 | | |
829 | 831 | | |
830 | 832 | | |
| |||
940 | 942 | | |
941 | 943 | | |
942 | 944 | | |
943 | | - | |
| 945 | + | |
944 | 946 | | |
945 | 947 | | |
946 | 948 | | |
| |||
1225 | 1227 | | |
1226 | 1228 | | |
1227 | 1229 | | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1228 | 1233 | | |
1229 | | - | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1249 | 1254 | | |
1250 | 1255 | | |
1251 | 1256 | | |
| |||
0 commit comments