Skip to content

Instantly share code, notes, and snippets.

@DominikStyp
Created February 12, 2025 18:41
Show Gist options
  • Save DominikStyp/21926f622670a1b631094791cbd2b956 to your computer and use it in GitHub Desktop.
Save DominikStyp/21926f622670a1b631094791cbd2b956 to your computer and use it in GitHub Desktop.
Xdebug in PHPUnit with Laravel

Xdebug in tests

To make sure you can step debug run: export PHP_IDE_CONFIG="serverName=dev.portal.local" in your terminal before running tests. Also make sure you have this server configured in the PHPStorm Settings -> PHP -> Servers.

To disable warnings when IDE is not listening for connections do this, for example:

export XDEBUG_MODE=off && vendor/bin/phpunit tests/Feature/Test.php

To turn it on again do this, for example:

export XDEBUG_MODE=develop,debug && vendor/bin/phpunit tests/Feature/Test.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment