{#- PHP synthetic field assertion template
Context variables:
- assertion_kind: "chunks_content", "chunks_embeddings", "embeddings", "embedding_dimensions",
"embeddings_valid", "keywords", "skipped", "result_is_simple"
- assertion_type: assertion type ("is_true", "is_false", "count_equals", "equals", etc.)
- pred: predicate expression for boolean assertions
- field_name: synthetic field name (for error messages)
- result_var: result variable name
- expr: expression to evaluate (for embedding_dimensions)
- php_val: PHP formatted value string
#}
{%- if assertion_kind == "chunks_content" %}
{%- if assertion_type == "is_true" %}
$this->assertTrue({{ pred }});
{%- elif assertion_type == "is_false" %}
$this->assertFalse({{ pred }});
{%- else %}
// skipped: unsupported assertion type on synthetic field '{{ field_name }}'
{%- endif %}
{%- elif assertion_kind == "chunks_embeddings" %}
{%- if assertion_type == "is_true" %}
$this->assertTrue({{ pred }});
{%- elif assertion_type == "is_false" %}
$this->assertFalse({{ pred }});
{%- else %}
// skipped: unsupported assertion type on synthetic field '{{ field_name }}'
{%- endif %}
{%- elif assertion_kind == "embeddings" %}
{%- if assertion_type == "count_equals" %}
$this->assertCount({{ php_val }}, ${{ result_var }});
{%- elif assertion_type == "count_min" %}
$this->assertGreaterThanOrEqual({{ php_val }}, count(${{ result_var }}));
{%- elif assertion_type == "not_empty" %}
$this->assertNotEmpty(${{ result_var }});
{%- elif assertion_type == "is_empty" %}
$this->assertEmpty(${{ result_var }});
{%- else %}
// skipped: unsupported assertion type on synthetic field 'embeddings'
{%- endif %}
{%- elif assertion_kind == "embedding_dimensions" %}
{%- if assertion_type == "equals" %}
$this->assertEquals({{ php_val }}, {{ expr }});
{%- elif assertion_type == "greater_than" %}
$this->assertGreaterThan({{ php_val }}, {{ expr }});
{%- else %}
// skipped: unsupported assertion type on synthetic field 'embedding_dimensions'
{%- endif %}
{%- elif assertion_kind == "embeddings_valid" or assertion_kind == "embeddings_finite" or assertion_kind == "embeddings_non_zero" or assertion_kind == "embeddings_normalized" %}
{%- if assertion_type == "is_true" %}
$this->assertTrue({{ pred }});
{%- elif assertion_type == "is_false" %}
$this->assertFalse({{ pred }});
{%- else %}
// skipped: unsupported assertion type on synthetic field '{{ field_name }}'
{%- endif %}
{%- elif assertion_kind == "keywords" %}
// skipped: field '{{ field_name }}' not available on PHP ExtractionResult
{%- elif assertion_kind == "skipped" %}
// skipped: field '{{ field_name }}' not available on result type
{%- elif assertion_kind == "result_is_simple" %}
// skipped: result_is_simple, field '{{ field_name }}' not on simple result type
{%- endif %}