alef 0.63.0

Opinionated polyglot binding generator for Rust libraries
Documentation
{# PHP test method template for PHPUnit

   Context variables:
   - method_name: method name (snake_case)
   - description: fixture description
   - client_factory: client factory call (or empty string)
   - setup_lines: list of setup line strings
   - expects_error: boolean
   - error_test_body: fully-rendered test body for the `expects_error` branch (plain
     `expectException(\Exception::class)` when no error value is declared, or a
     try/catch checking message-or-class-name when one is)
   - skip_test: boolean (for unskipped non-assertions)
   - call_expr: the complete function call expression
   - result_var: result variable name
   - returns_void: bool — whether the call returns void (Rust `()` / `Result<(),E>`)
   - field_bindings: string with field binding statements (e.g., $chunks = $result->getChunks();)
   - assertions_body: string containing all rendered assertions
#}

    /** {{ description }} */
    public function test_{{ method_name }}(): void
    {
{% if client_factory %}
        {{ client_factory }}
{% endif %}
{% if expects_error %}
{{ error_test_body }}
{% elif skip_test %}
{% for line in setup_lines %}
        {{ line }}
{% endfor %}
        ${{ result_var }} = {{ call_expr }};
{% if returns_void %}
        $this->assertTrue(true, 'expected the call not to throw');
{% else %}
        $this->assertNotNull(${{ result_var }});
{% endif %}
{% else %}
{% for line in setup_lines %}
        {{ line }}
{% endfor %}
        ${{ result_var }} = {{ call_expr }};
{% if collect_snippet %}
        {{ collect_snippet }}
{% endif %}
{{ field_bindings }}
{{ assertions_body }}
{% endif %}
{{ teardown_block }}
    }