php_unit_test_class_requires_covers.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ============================================
  2. Rule ``php_unit_test_class_requires_covers``
  3. ============================================
  4. Adds a default ``@coversNothing`` annotation to PHPUnit test classes that have
  5. no ``@covers*`` annotation.
  6. Examples
  7. --------
  8. Example #1
  9. ~~~~~~~~~~
  10. .. code-block:: diff
  11. --- Original
  12. +++ New
  13. <?php
  14. +
  15. +/**
  16. + * @coversNothing
  17. + */
  18. final class MyTest extends \PHPUnit_Framework_TestCase
  19. {
  20. public function testSomeTest()
  21. {
  22. $this->assertSame(a(), b());
  23. }
  24. }
  25. Rule sets
  26. ---------
  27. The rule is part of the following rule set:
  28. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  29. References
  30. ----------
  31. - Fixer class: `PhpCsFixer\\Fixer\\PhpUnit\\PhpUnitTestClassRequiresCoversFixer <./../../../src/Fixer/PhpUnit/PhpUnitTestClassRequiresCoversFixer.php>`_
  32. - Test class: `PhpCsFixer\\Tests\\Fixer\\PhpUnit\\PhpUnitTestClassRequiresCoversFixerTest <./../../../tests/Fixer/PhpUnit/PhpUnitTestClassRequiresCoversFixerTest.php>`_
  33. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.