fix: array_merge P0 + restore check-constants self-test P1 (v0.22.0)

P0: replace `+` array union with array_merge() in
Settings_Fields_Extended::get_fields(). PHP `+` keeps left-side keys
when both arrays are integer-indexed — silently drops all 11 image fields
(indexes 0–10 collide with indexes 0–10 of the local array). array_merge()
is already the operator used by the parent class at class-settings-fields.php:84.

P1: restore `php scripts/check-constants.php --self-test` step in the
check-constants CI job. Step was present in v0.21.0 and accidentally dropped
in the CI rewrite. Script logic is intact; CI now exercises it again.

Also adds SettingsFieldsExtendedTest (3 assertions) as a regression guard:
cardinality (29 = 18 local + 11 image), presence check, and per-field
id/section contract. If a + union ever re-appears, test_get_fields_returns_29_fields
fails with a message naming the root cause.

Agent-Session: engineer-infra-prab-p0fix-20260616
This commit is contained in:
peptiderepo
2026-06-16 14:38:46 +00:00
parent 7217c154bb
commit 0bac82be52
3 changed files with 86 additions and 2 deletions

View File

@@ -35,7 +35,8 @@ class PRAutoBlogger_Settings_Fields_Extended {
* @return array<int, array<string, mixed>>
*/
public static function get_fields(): array {
return array(
return array_merge(
array(
// ── Sources (extended) ──────────────────────────────────────
array(
'id' => 'prautoblogger_research_model',
@@ -220,6 +221,7 @@ class PRAutoBlogger_Settings_Fields_Extended {
'default' => '1',
'description' => __( 'Add visible borders, padding, and alternating row colors to tables in generated articles.', 'prautoblogger' ),
),
) + PRAutoBlogger_Settings_Fields_Images::get_fields();
), PRAutoBlogger_Settings_Fields_Images::get_fields()
);
}
}