Skip to content

[PHPUnitBridge] Added docs for the CoverageListener #8416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 29, 2017

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Sep 22, 2017


.. code-block:: xml

<listeners>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the whole code block needs to be indented by additional four spaces

fabpot added a commit to symfony/symfony that referenced this pull request Sep 26, 2017
…e code coverage report (lyrixx)

This PR was squashed before being merged into the 3.4 branch (closes #23149).

Discussion
----------

[PhpUnitBridge] Added a CoverageListener to enhance the code coverage report

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#8416

---

The code coverage computed by PHPUnit is not very accurate by default as it marks a line as tested as soon as it has been executed.
For example, if you have two classes A and B where A is using B and you write test only for the class A then the class B will be marked as tested.

You can fix this issue by adding `@covers A` on top of the class ATest, but it's a bit boring.

This Listener add this annotation on each test if it's applicable:
* If an annotation already exists, we do nothing.
* We try to find the SUT thanks to the Test class name, if it does not exist, we do nothing

---

If you wan to see it in action: https://github.com/lyrixx/phpunit-auto-cover

---

The PR is not finished, I think we could add this listener to symfony itself.

What do you think?

Commits
-------

e17206d [PhpUnitBridge] Added a CoverageListener to enhance the code coverage report
@javiereguiluz javiereguiluz added this to the 3.4 milestone Sep 27, 2017
@lyrixx
Copy link
Member Author

lyrixx commented Oct 9, 2017

Thanks @javiereguiluz ;)

@weaverryan weaverryan merged commit c21ab16 into symfony:3.4 Oct 29, 2017
weaverryan added a commit that referenced this pull request Oct 29, 2017
…rixx, javiereguiluz)

This PR was merged into the 3.4 branch.

Discussion
----------

[PHPUnitBridge] Added docs for the CoverageListener

For symfony/symfony#23149

Commits
-------

c21ab16 Fixed code indentation
e78804b Minor rewords
81365f3 [PHPUnitBridge] Added docs for the CoverageListener
weaverryan added a commit that referenced this pull request Oct 29, 2017
@weaverryan
Copy link
Member

Cool feature @lyrixx! And thanks so much for doc'ing it - it indeed saved a lot of time :)

@lyrixx lyrixx deleted the phpunit branch October 29, 2017 12:05
weaverryan added a commit that referenced this pull request Oct 29, 2017
* 3.4: (81 commits)
  Fixed a RST syntax issue
  Mention that ACL is deprecated in the security config reference
  Update questionhelper.rst
  Remove TableHelper Page
  [#8416] Minor tweaks
  Minor tweaks to #8502
  Documented the new config prototype shortcuts
  Document the new RequestExceptionInterface
  Docs re-org and removal of small sections
  Processed xabbuh comments
  Fixes
  Fixed a grammar issue
  remove deprecated feature description
  Fix a small typo error (number.rst)
  Remove deprecated proxy argument
  Fix instance of class in express language in DI
  Missing use reference
  Unused Private param in documentation
  Doctrine event listener could persist a null value
  Added about command in debug page
  ...
xabbuh added a commit that referenced this pull request Mar 22, 2019
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Mar 22, 2019
* 3.4:
  Add missing security guard sub-component
  [symfony#8416] some minor tweaks
  Update unit_testing.rst
  removed blank line and space
  use "behavior" instead of "behaviour"
  Remove unnecessary backslash escape
  Improve now what sentence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants