Skip to content

Normalize bracketed placeholders when building array schemas#40

Merged
erseco merged 2 commits intomainfrom
feature/add-array-fields-for-annexes-support-wgdv7n
Oct 14, 2025
Merged

Normalize bracketed placeholders when building array schemas#40
erseco merged 2 commits intomainfrom
feature/add-array-fields-for-annexes-support-wgdv7n

Conversation

@erseco
Copy link
Copy Markdown
Collaborator

@erseco erseco commented Oct 14, 2025

Summary

  • strip leading and trailing bracket characters from parsed placeholders so annex markers are detected as repeatable arrays
  • ensure array placeholder detectors reuse the sanitized names and cover the behavior with a regression test for bracketed tokens

Testing

  • composer test -- tests/unit/includes/ResolateTemplateParserTest.php (fails: vendor/bin/phpunit not found in the container)

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

@erseco erseco merged commit 47d860a into main Oct 14, 2025
2 of 3 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 +158 to +178
/**
* It should expose array schema definitions when reading the term configuration.
*/
public function test_get_term_schema_returns_array_definition() {
$term = wp_insert_term( 'Tipo Esquema', 'resolate_doc_type' );
$term_id = intval( $term['term_id'] );
$schema = $this->get_annex_schema();
update_term_meta( $term_id, 'schema', $schema );
update_term_meta( $term_id, 'resolate_type_fields', $schema );

$result = Resolate_Documents::get_term_schema( $term_id );

$this->assertNotEmpty( $result );
$this->assertSame( 'annexes', $result[0]['slug'] );
$this->assertSame( 'array', $result[0]['type'] );
$this->assertSame( 'array', $result[0]['data_type'] );
$this->assertArrayHasKey( 'item_schema', $result[0] );
$this->assertArrayHasKey( 'number', $result[0]['item_schema'] );
$this->assertSame( 'single', $result[0]['item_schema']['number']['type'] );
$this->assertSame( 'Número', $result[0]['item_schema']['number']['label'] );
}
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 Remove stray method outside test class

After the class closing brace, the file defines another public function test_get_term_schema_returns_array_definition() at global scope. PHP does not allow visibility keywords outside a class, so including this file throws a parse error (unexpected token "public") and will prevent the unit test suite from running. Move this test inside ResolateDocumentsArrayFieldsTest (or into a new class) to restore syntactically valid test code.

Useful? React with 👍 / 👎.

@erseco erseco deleted the feature/add-array-fields-for-annexes-support-wgdv7n 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