-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
feat: Add references
method for two-way test-source linking
#1241
base: 3.x
Are you sure you want to change the base?
Conversation
Usefully, perfect!! |
Smart solution, and definitely a needed one. Thanks for addressing this. |
@mertasan why not use the |
@dshafik thank you for your suggestion. however, I believe that methods should be used according to their intended purpose. the |
Thanks for this PR @mertasan . In complex projects, identifying the method a particular test is targeting can become increasingly difficult. So this PR offers a great solution to help us overcome this difficulty. |
A very super approach to a topic that is definitely needed, thank you very much. |
Co-authored-by: Owen Voke <[email protected]>
Co-authored-by: Owen Voke <[email protected]>
reference
method for two-way test-source linkingreferences
method for two-way test-source linking
I just came across this PR and wanted to express my support for this feature! We’ve been in the same situation, where we heavily rely on the ability to navigate between tests and source code, especially as we transition our suite to PEST. Losing that seamless connection has slowed us down quite a bit, so the reference() method would truly be a game-changer for our workflow as well. This feature would be a great addition for anyone moving from PHPUnit to PEST and using powerful IDEs like PHPStorm. It would make the migration smoother for many teams, which I think would benefit PEST’s growing community. Would it be possible to get some feedback or updates on this PR? Thanks so much for considering, and thank you to the contributor for the work done here! |
What:
Description:
In this pull request, I am adding a reference method to address an adaptation issue we encountered during our transition from PHPUnit to PEST. While using PHPUnit, we heavily rely on the
@see
annotation to provide direct references from test methods to source code methods.This makes navigation in IDEs like PHPStorm smoother and improves the development process. However, when we transition to PEST, this functionality is lost.
To solve this, the reference() method comes into play. This method restores the lost functionality in PEST, enabling direct references between test callbacks and the source code methods. IDEs like PHPStorm will be able to navigate from test functions directly to the source code methods, similar to how it worked with
@see
in PHPUnit. Additionally, the method is lightweight and doesn't introduce any performance overhead.Benefits of this Method:
Improved IDE Support:
With the reference method, developers using PHPStorm will be able to maintain the connection between test functions and the source code methods. This makes it easier to navigate between tests and code, just like when using
@see
in PHPUnit.Easier Migration:
One of the key challenges for companies migrating from PHPUnit to PEST is the loss of reference functionality provided by
@see
. This reference method helps alleviate this issue and makes the transition smoother while keeping the tests readable and maintainable.No Performance Impact:
Since the method is empty, it has no performance impact on PEST. It simply serves as a way to provide IDE integration and navigation without adding any overhead.
Broad Applicability:
We believe this solution is not only beneficial to our company but also for many other teams that rely on strong references between tests and the source code methods. Any company using
@see
annotations in their tests will find this method useful in PEST.With the recent release of PEST PHP version 3, this method provides a lightweight solution that enhances IDE integration without imposing any additional burden or disrupting the framework’s structure. For developers using powerful IDEs like PHPStorm, this feature will be highly beneficial, offering improved functionality without adding unnecessary overhead to PEST.
pestphp_reference.mov