php_unit_internal_class.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ================================
  2. Rule ``php_unit_internal_class``
  3. ================================
  4. All PHPUnit test classes should be marked as internal.
  5. Configuration
  6. -------------
  7. ``types``
  8. ~~~~~~~~~
  9. What types of classes to mark as internal.
  10. Allowed values: a subset of ``['abstract', 'final', 'normal']``
  11. Default value: ``['normal', 'final']``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. +
  22. +/**
  23. + * @internal
  24. + */
  25. class MyTest extends TestCase {}
  26. Example #2
  27. ~~~~~~~~~~
  28. With configuration: ``['types' => ['final']]``.
  29. .. code-block:: diff
  30. --- Original
  31. +++ New
  32. <?php
  33. class MyTest extends TestCase {}
  34. +/**
  35. + * @internal
  36. + */
  37. final class FinalTest extends TestCase {}
  38. abstract class AbstractTest extends TestCase {}
  39. Rule sets
  40. ---------
  41. The rule is part of the following rule set:
  42. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  43. References
  44. ----------
  45. - Fixer class: `PhpCsFixer\\Fixer\\PhpUnit\\PhpUnitInternalClassFixer <./../../../src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php>`_
  46. - Test class: `PhpCsFixer\\Tests\\Fixer\\PhpUnit\\PhpUnitInternalClassFixerTest <./../../../tests/Fixer/PhpUnit/PhpUnitInternalClassFixerTest.php>`_
  47. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.