![]() ![]() To enable automatic HTML screenshots when running Functional tests:Įdit the tag: add printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter". This gives you a file with a list of all tests that ran, and whether or not they failed. On the CLI run with the -debug flag: vendor/bin/phpunit -debug -configuration core/phpunit.xml In PhpStorm the current progress and test being run are shown on the left in the run panel. To print the PHP and Xdebug version and config file path:.To allow output during a test script (so you can use print, echo and var_dump):Įdit the tag: set beStrictAboutOutputDuringTests="false".For more even more advanced tests (Functional and up) configure a base URL:.For more advanced tests (KernelTest and up) configure a database path:.More advanced tests need some extra configuration, and you can also tweak the settings in other ways. PhpStorm will now launch from a configured shell, and your php.ini should be correct in the CLI Interpreter settings.Ĭopy the PHPUnit config file core/ to core/phpunit.xml. Now quit PhpStorm and open your Terminal and invoke the command-line PhpStorm launcher. If you don't see the correct php.ini in the CLI Interpreter settings you can force PhpStorm to use your shell environment: Go to Tools > Create Command-line Launcher. Since $PHPRC is set during bash start-up, it's never set for PhpStorm. This sets up a $PHPRC environment variable to point to the php.ini. Optionally: When you use MAMP PRO 4 the php CLI environment is configured using the. Test Runner: Set the default configuration file to your core/phpunit.xml file (It might not yet exist). "/Applications/MAMP/htdocs/d8development/core/phpunit.xml" in my case.PHPUnit library: Use Composer autoloader: Set 'Path to script' to the Drupal root autoloader: "/Applications/MAMP/htdocs/d8development/autoload.php" in my case.Preferences > Languages & Frameworks > PHP > PHPUnit.Disable Force break when no outside the project.Disable Force break when no path mapping specified.Preferences > Languages & Frameworks > PHP > Debug.It should report a PHP version (7.1.0) and an Xdebugger version (2.5.0) and the correct ini file path. Click the … button to add an interpreter or to check existing interpreter supports Xdebug. CLI Interpreter: set the interpreter to the same php executable as the CLI.PHP language level: match this to the version of PHP you use on the CLI.Preferences > Languages & Frameworks > PHP. ![]() To enable all this in PhpStorm set the following config: The second PHP process started by the cURL request should be passed the correct session variables, get parameters, and cookies so that it will connect to the Xdebug client and the Xdebug client should accept multiple connections. ĭebugging tests using Xdebug is different from debugging other processes, because tests go through cURL rather than through your browser. ![]() Always make sure your test installation is reachable at the docroot: instead of. NB: some Functional Tests fail when you run drupal from a subdir. Sanity check #2: Now if you enable debug listening in PhpStorm and run a Drush command (drush status) your debugger should halt at the first line of the drush php script file in PhpStorm. If not, make sure your php command uses the correct php executable, set the correct path variable in your shell if needed: export PATH=/Applications/MAMP/bin/php/php7.1.0/bin:$PATH This should report your ini settings above. I recommend to use the same php version and same php.ini on the CLI that you use in your webserver, so you only need to set your config in one place. Otherwise you will need to make sure the CLI php.ini (there usually is a separate CLI version) has the debug config info set. In MAMP PRO 4 got to PHP > Default version and enable "Make this version available on the command line". Next enable command line (CLI) debugging. Sanity check#1: Now if you enable debug listening in PhpStorm and set a breakpoint in index.php and reload your local Drupal installation in your browser your debugger should halt at the breakpoint in PhpStorm. Otherwise locate your local webserver's php.ini and add the following: zend_extension="" In MAMP PRO got to PHP > Extentions and enable Xdebug. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |