test(classifier): exact-count assertions for placeholder fixture; document SERVICE_FIELD_KEYS prefix semantics

Fixes issues from code review in commit 249f195:

1. Tighten fixture assertions to exact counts (assertSame instead of assertGreaterThanOrEqual):
   - test_count_placeholder_fields_screenshot_1_exact_count: expect 5 placeholders
   - test_count_placeholder_fields_screenshot_2_exact_count: expect 5 placeholders
   - test_count_placeholder_fields_screenshot_3_exact_count: expect 1 placeholder

2. Document SERVICE_FIELD_KEYS prefix-matching semantics in comment:
   clarify that keys starting with _wpcf7 are skipped via strpos prefix match,
   so explicit enumeration of every _wpcf7_* variant is unnecessary.

Test results: 75/75 green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vladimir Bryzgalov
2026-04-21 16:08:57 +05:00
parent 249f195257
commit 18a07c9b1b
2 changed files with 24 additions and 4 deletions
+6 -1
View File
@@ -46,7 +46,12 @@ final class Classifier
'rambler.ru', 'gmail.com',
];
/** Service field keys excluded from placeholder count. */
/**
* Explicit service field keys excluded from placeholder count.
* Note: keys starting with `_wpcf7` are also skipped via prefix match
* (see count_placeholder_fields), so this list does not need to enumerate
* every `_wpcf7_*` variant — only non-prefixed service keys.
*/
private const SERVICE_FIELD_KEYS = [
'acceptance-data',
'_wpcf7', '_wpcf7_version', '_wpcf7_locale', '_wpcf7_unit_tag',