Skip to content

Add unit tests for annex array field handling#36

Merged
erseco merged 1 commit intomainfrom
feature/add-array-fields-for-annexes-support
Oct 14, 2025
Merged

Add unit tests for annex array field handling#36
erseco merged 1 commit intomainfrom
feature/add-array-fields-for-annexes-support

Conversation

@erseco
Copy link
Copy Markdown
Collaborator

@erseco erseco commented Oct 14, 2025

Summary

  • add a Resolate_Template_Parser test covering array placeholder detection
  • cover Resolate_Documents saving logic for array fields and item limits
  • ensure Resolate_Document_Generator exposes annexes as decoded arrays for exports

Testing

  • composer test (fails: missing WordPress wp-tests-config.php in this environment)

https://chatgpt.com/codex/tasks/task_e_68ee30cf252083229149dd9f656091e1

@erseco erseco merged commit abab78f into main Oct 14, 2025
3 of 4 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +49 to +51

$schema = Resolate_Template_Parser::build_schema_from_field_definitions( $fields );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid calling undefined schema builder

ResolateTemplateParserTest::test_build_schema_from_field_definitions_detects_arrays() invokes Resolate_Template_Parser::build_schema_from_field_definitions(), but Resolate_Template_Parser does not declare that method anywhere in includes/class-resolate-template-parser.php. Executing the test suite will therefore fatally error before the assertions run. The parser needs a matching API or the test should target an existing function so tests can execute.

Useful? React with 👍 / 👎.

Comment on lines +90 to +95
$items = array();
for ( $i = 0; $i < Resolate_Documents::ARRAY_FIELD_MAX_ITEMS + 5; $i++ ) {
$items[] = array(
'number' => 'N' . $i,
'title' => 'Título ' . $i,
'content' => 'Contenido ' . $i,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Undefined ARRAY_FIELD_MAX_ITEMS constant in tests

ResolateDocumentsArrayFieldsTest references Resolate_Documents::ARRAY_FIELD_MAX_ITEMS when creating and asserting annex entries, but the Resolate_Documents class defines no such constant anywhere in the codebase. Running the tests will immediately raise an "Undefined constant" fatal error. Introduce the constant on the class (or inline a literal value in the test) before relying on it.

Useful? React with 👍 / 👎.

@erseco erseco deleted the feature/add-array-fields-for-annexes-support branch November 30, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant