Skip to content
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

#[CoversNamespace] and #[UsesNamespace] #4463

Open
sebastianbergmann opened this issue Sep 23, 2020 · 7 comments
Open

#[CoversNamespace] and #[UsesNamespace] #4463

sebastianbergmann opened this issue Sep 23, 2020 · 7 comments
Labels
feature/code-coverage Issues related to code coverage (but not php-code-coverage) feature/metadata Issues related to attributes and annotations type/enhancement A new idea that should be implemented

Comments

@sebastianbergmann
Copy link
Owner

sebastianbergmann commented Sep 23, 2020

Suggested by @spriebsch:

  • @covers-namespace vendor\foo should cover all units of code where the fully qualified name of the unit begins with vendor\foo
  • @uses-namespace vendor\foo should allow all units of code where the fully qualified name of the unit begins with vendor\foo
@sebastianbergmann sebastianbergmann added type/enhancement A new idea that should be implemented feature/code-coverage Issues related to code coverage (but not php-code-coverage) labels Sep 23, 2020
@sebastianbergmann sebastianbergmann added the feature/metadata Issues related to attributes and annotations label Jun 3, 2021
@sebastianbergmann sebastianbergmann changed the title @covers / @uses annotations for namespaces #[CoversNamespace] and #[UsesNamespace] Mar 10, 2024
@sebastianbergmann
Copy link
Owner Author

@spriebsch Do you still think that this would be useful?

@spriebsch
Copy link

I'd say this conversation is way beyond what should be discussed in ticket comments.

@nikophil
Copy link
Contributor

nikophil commented Aug 4, 2024

Hi!

I'd be interested into this feature. Would you accept a PR about it?

@sebastianbergmann
Copy link
Owner Author

I do not see how this can be implemented before sebastianbergmann/php-code-coverage#519 has been implemented.

@nikophil
Copy link
Contributor

nikophil commented Aug 5, 2024

this issue is pretty old, is there a blocker here? or does it needs a huge effort to be fixed?

@carnage
Copy link

carnage commented Oct 1, 2024

@spriebsch Do you still think that this would be useful?

I came here to open this issue as I think it's a useful feature.

My use case revolves around component level testing for parser type classes which, for example, read a data structure from json/yaml and parse it into a set of data objects. The test should produce coverage for all the data objects as well as the parser class itself.

@charjr
Copy link

charjr commented Oct 7, 2024

Here's a use-case

We have many, many small classes with specific jobs.
Once we start getting into functional tests, making use of many of those classes. We start having over 60 LoC dedicated to #[UsesClass]

On top of this, half of the classes we've imported are only imported to use inside #[UsesClass] so this effectively doubles it. You have to scroll to L150 before you even see the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/code-coverage Issues related to code coverage (but not php-code-coverage) feature/metadata Issues related to attributes and annotations type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

5 participants