From 200257d16c83c808ba06322004ec96d9aeb4833d Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Thu, 23 Feb 2023 15:38:07 +0100 Subject: [PATCH] Initial work on documentation for the IgnoreClassForCodeCoverage, IgnoreMethodForCodeCoverage, and IgnoreFunctionForCodeCoverage attributes --- src/attributes.rst | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/attributes.rst b/src/attributes.rst index 0e191b75..58fb371a 100644 --- a/src/attributes.rst +++ b/src/attributes.rst @@ -257,6 +257,44 @@ The ``UsesFunction(string $functionName)`` attribute can be used to :ref:`specif that a test allows the execution of code in the given global function, but does not intend to cover it. This is relevant in the context of :ref:`preventing unintentionally covered code `. +.. _appendixes.attributes.IgnoreClassForCodeCoverage: + +``IgnoreClassForCodeCoverage`` +------------------------------ + ++-----------+-------------+--------------+------------+ +| Context | Class Level | Method Level | Repeatable | ++===========+=============+==============+============+ +| Test Code | yes | no | yes | ++-----------+-------------+--------------+------------+ + +The ``IgnoreClassForCodeCoverage(string $className)`` attribute can be used to ... todo ... + +.. _appendixes.attributes.IgnoreMethodForCodeCoverage: + +``IgnoreMethodForCodeCoverage`` +------------------------------- + ++-----------+-------------+--------------+------------+ +| Context | Class Level | Method Level | Repeatable | ++===========+=============+==============+============+ +| Test Code | yes | no | yes | ++-----------+-------------+--------------+------------+ + +The ``IgnoreMethodForCodeCoverage(string $className, string $methodName)`` attribute can be used to ... todo ... + +.. _appendixes.attributes.IgnoreFunctionForCodeCoverage: + +``IgnoreFunctionForCodeCoverage`` +--------------------------------- + ++-----------+-------------+--------------+------------+ +| Context | Class Level | Method Level | Repeatable | ++===========+=============+==============+============+ +| Test Code | yes | no | yes | ++-----------+-------------+--------------+------------+ + +The ``IgnoreFunctionForCodeCoverage(string $functionName)`` attribute can be used to ... todo ... .. _appendixes.attributes.CodeCoverageIgnore: @@ -278,6 +316,10 @@ The ``CodeCoverageIgnore`` attribute can be used in production code to to code uses the Reflection API to instantiate attributes it is not responsible for, for instance PHPUnit's. +As of PHPUnit 10.1, the ``CodeCoverageIgnore`` attribute (as well as the ``@codeCoverageIgnore`` +annotations) is deprecated. Use the ``IgnoreClassForCodeCoverage``, ``IgnoreMethodForCodeCoverage``, +and ``IgnoreFunctionForCodeCoverage`` attributes on test classes instead. + Data Provider =============