pest-intellij
pest-intellij copied to clipboard
PhpStorm Autocomplete not working in closures
The biggest hurdle preventing me from using PEST everywhere is that PhpStorm doesn't seem to know what $this
is inside pest test closures.
Is this an issue with my configuration?
Check:
Because of the issue, I cannot autocomplete assertions on responses either.
Just want to add, I do have the plugin installed, and updated this morning:
Thanks for reporting this. This is a feature we already support, could you share your folder structure or a demo project where I can reproduce?
Here you go:
-
I created a new laravel project to test this out: https://gitlab.com/jadonbrown/pest-test
-
I installed Pest following the documentation on https://pestphp.com/docs/installation
-
I created a command using
php artisan make:test --pest ExamplePestTest
. This createdtests/Feature/ExamplePestTest.php
. -
I've got the Pest plugin enabled.
-
I'm still not getting autocomplete features in the Pest test.
Is there maybe a workaround for this issue?
@scheMeZa thank you for providing an example. No idea if there is a workaround, I haven't looked into it yet.
@scheMeZa I have cloned your repository and tried out locally and this is what happens for me.
So this means there is something in your setup interfering here 🤔
I can see you have a lot of plugins installed, a thing we could try is if you disable all the plugins installed from marketplace and only have pest plugin installed. Is it then working? 👀 (we will enable again, just need to figure out if we can isolate the issue)
I noticed the same when using uses(class)->in(__DIR__)
.
uses(class)->in('./')
fixed it for me.
@ostark what version are you running? I am pretty sure we did add support for __dir__
already 🤔
That worked for me, thank you :)
I had mine set to:
uses(TestCase::class)->in('./Features');
uses(TestCase::class)->in('./Unit');
Switching to
uses(TestCase::class)->in('./');
fixed IntelliSense for me.
I am completely unable to reproduce this on v1.8.0.
Closing as it seems like you found a solution anyways.