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

Suggestion for modules' web pages: Add a hint to all methods of a certain trait #529

Open
ThomasLandauer opened this issue Sep 27, 2021 · 3 comments

Comments

@ThomasLandauer
Copy link
Member

It would be nice to have way to somehow add a hint to some trait (e.g. https://github.com/Codeception/module-symfony/blob/main/src/Codeception/Module/Symfony/SecurityAssertionsTrait.php), and then have this hint displayed at all methods of that trait (e.g. https://codeception.com/docs/modules/Symfony#dontSeeAuthentication).

Background: That security trait requires Symfony's security.helper service to be declared public, see Codeception/module-symfony#138, and there might be more use cases in the future where something has to be explained for an entire trait.

@Naktibalda what do you think?

@TavoNiievez
Copy link
Member

the laravel module also splits its assertions into Traits, and the Lumen module will do the same soon.

I think it would be useful to be able to docblocks for traits.

Or even more, to be able to somehow organize the assertions in the website documentation according to the trait to which they belong.

Keep things that are related together, right?

@ThomasLandauer
Copy link
Member Author

Or even more, to be able to somehow organize the assertions in the website documentation according to the trait to which they belong.

I already suggested one step into this direction at Codeception/Codeception#6063 (comment):

On the framework pages, on each function add a note where the source code lives.

But after thinking some more about it, your idea is even better! Let's drop the alphabetical order in favor of trait "sections" - both in the page and in the index column (right hand side)

Why?

  • Index: The Symfony Module page now lists 131 actions. These are too many IMO for alphabetical searching (i.e. nobody is scanning this list from top to bottom). Organizing the index into chapters would make it easier.
  • Page itself: If I'm reading https://codeception.com/docs/modules/Symfony#seeEmailIsSent, I'm probably more interested in grabLastSentEmail (=next in the trait), than in seeEventTriggered (=next in alphabet)

So the solution would then be to have a docblock for the trait, and this is displayed as "introduction" of this trait's section on the page. So (for now) repeating stuff at multiple functions isn't even necessary.

@ThomasLandauer
Copy link
Member Author

This would also make my idea to add some "see also" links obsolete, which I started at Codeception/module-symfony#122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants