php_unit_size_class.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ============================
  2. Rule ``php_unit_size_class``
  3. ============================
  4. All PHPUnit test cases should have ``@small``, ``@medium`` or ``@large``
  5. annotation to enable run time limits.
  6. Description
  7. -----------
  8. The special groups [small, medium, large] provides a way to identify tests that
  9. are taking long to be executed.
  10. Configuration
  11. -------------
  12. ``group``
  13. ~~~~~~~~~
  14. Define a specific group to be used in case no group is already in use.
  15. Allowed values: ``'large'``, ``'medium'`` and ``'small'``
  16. Default value: ``'small'``
  17. Examples
  18. --------
  19. Example #1
  20. ~~~~~~~~~~
  21. *Default* configuration.
  22. .. code-block:: diff
  23. --- Original
  24. +++ New
  25. <?php
  26. +
  27. +/**
  28. + * @small
  29. + */
  30. class MyTest extends TestCase {}
  31. Example #2
  32. ~~~~~~~~~~
  33. With configuration: ``['group' => 'medium']``.
  34. .. code-block:: diff
  35. --- Original
  36. +++ New
  37. <?php
  38. +
  39. +/**
  40. + * @medium
  41. + */
  42. class MyTest extends TestCase {}
  43. References
  44. ----------
  45. - Fixer class: `PhpCsFixer\\Fixer\\PhpUnit\\PhpUnitSizeClassFixer <./../../../src/Fixer/PhpUnit/PhpUnitSizeClassFixer.php>`_
  46. - Test class: `PhpCsFixer\\Tests\\Fixer\\PhpUnit\\PhpUnitSizeClassFixerTest <./../../../tests/Fixer/PhpUnit/PhpUnitSizeClassFixerTest.php>`_
  47. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.