ramsey,
@ramsey@phpc.social avatar

I’m trying to run “Debug” (for step-debugging with ) in while running a test. I do this all the time with standard tests, and I’ve never had this problem…

The test runner stops immediately, and PhpStorm reports in the debug console, “Test framework quit unexpectedly.”

Has anyone else seen this error? Do you know what causes it?

ramsey,
@ramsey@phpc.social avatar

Oh… wait! I probably need to tell PhpStorm to use vendor/bin/pest to run the test, rather than vendor/bin/phpunit.

bobmagicii,
@bobmagicii@phpc.social avatar

@ramsey people think my pascal case is weird, but pest makes a config file that is capitalised?!?! lol. what?

that is going to drive me nuts next to my composer.json, phpcs.xml, phpunit.xml, env.lock, and phinx.php

ramsey,
@ramsey@phpc.social avatar

@bobmagicii It goes in tests/, and it seems you can’t configure where it lives. It must live in tests/.

bobmagicii,
@bobmagicii@phpc.social avatar

@ramsey so it was named Pest for a reason 🤣

ramsey,
@ramsey@phpc.social avatar

Actually, I already have the Pest plugin installed in PhpStorm, and it appears to know that these are Pest tests, so I think it’s set up correctly.

But I’m not sure if I need to change something to get it to work properly when I select “Debug” from the “Run” context menu.

The “Run” context menu that appears when you click the green arrow next to a test case in PhpStorm. It has four options: 1. Run 2. Debug 3. Run with Coverage 4. Modify Run Configuration

ramsey,
@ramsey@phpc.social avatar

So, it turns out, if you want to name your test files something like example.pest.php, then PhpStorm decides it doesn’t like you, but if you name them example.php (or ExampleTest.php as recommended by Pest), then step debugging with PhpStorm (with Xdebug) works.

The reason I got this error was solely because of the .pest.php extension.

gwynae,

@ramsey Yay! I never would have guessed that one. 🎉

ramsey,
@ramsey@phpc.social avatar

@gwynae Me either. I have no idea why the extension matters.

gwynae,

@ramsey Someone hardcoded something.

ianh,

@ramsey @gwynae Silly question Ben... do you have this defined in phpunit.xml? The "old" syntax used to be, for example:

<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>

I remove the 'suffix' attribute because PHPUnit defaults to 'Test.php' as the file suffix. I've not used Pest, but looking at your config screenshot, you're using the same phpunit.xml config so wondering whether it's in there by default?

ramsey,
@ramsey@phpc.social avatar

@ianh @gwynae I had it set to .pest.php. Apparently, PhpStorm doesn’t like an extension other than .php.

https://phpc.social/@ramsey/110506096895281278

gwynae,

@ramsey Could that be an error in the path?

gwynae,

@ramsey oh rats I was too slow to help. 😆

ramsey,
@ramsey@phpc.social avatar
gwynae,

@ramsey oh darn. What about the configuration? Have you tried just making a new run? Maybe something got fouled in the temp?

ramsey,
@ramsey@phpc.social avatar

@gwynae Yep, must be something fouled in that project. I just started a brand new project, installed Pest, and then ran Debug against one of the example tests, and step debugging works just fine.

gwynae,

@ramsey Excellent! That makes it much easier to troubleshoot.

ramsey,
@ramsey@phpc.social avatar

@gwynae Issue solved. Thanks! :rubber_duck:

https://phpc.social/@ramsey/110506096895281278

gwynae,

@ramsey 😊 Happy to help!!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • DreamBathrooms
  • magazineikmin
  • ethstaker
  • InstantRegret
  • tacticalgear
  • rosin
  • love
  • Youngstown
  • slotface
  • ngwrru68w68
  • kavyap
  • cubers
  • thenastyranch
  • mdbf
  • provamag3
  • modclub
  • GTA5RPClips
  • normalnudes
  • khanakhh
  • everett
  • cisconetworking
  • osvaldo12
  • anitta
  • Leos
  • Durango
  • tester
  • megavids
  • JUstTest
  • All magazines