mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
9a602c7532360e7faac7a684f983ba5f643d0f56
@codeCoverageIgnore to untestable compiled methods (markhuot)
This PR was merged into the 3.x branch.
Discussion
----------
Add `@codeCoverageIgnore` to untestable compiled methods
I've been experimenting with adding my compiled templates to my code coverage reports and it works largely as expected. Templates that get executed return percentages accurate to the number of lines the tests actually cover. The only exception are the "meta" methods on the compiled template that aren't necessarily called by the tests.
This PR adds ``@codeCoverageIgnore`` comments to the compiled template for all non-display methods so the coverage report only lists lines from `doDisplay`.
I'm assuming that I will need to update some of the Twig tests to account for these new comments, but am curious if you'd be open to this change.
An example screenshot below. The last line shows line 46 out of the compiled template is never executed. The compiled template's `getDebugInfo` even correctly informs me that line 46 maps to line 4 in my `.twig` so I'll work on updating the line numbering next.

Commits
-------
1cf610bd Add `@codeCoverageIgnore` to untestable compiled methods
…
Twig, the flexible, fast, and secure template language for PHP
==============================================================
Twig is a template language for PHP.
Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.
Sponsors
--------
.. raw:: html
<a href="https://blackfire.io/docs/introduction?utm_source=twig&utm_medium=github_readme&utm_campaign=logo">
<img src="https://static.blackfire.io/assets/intemporals/logo/png/blackfire-io_secondary_horizontal_transparent.png?1" width="255px" alt="Blackfire.io">
</a>
More Information
----------------
Read the `documentation`_ for more information.
.. _documentation: https://twig.symfony.com/documentation
Description
Languages
PHP
99.9%