Skip to content

Instantly share code, notes, and snippets.

@danielsdeboer
Created May 4, 2018 15:35
Show Gist options
  • Save danielsdeboer/3aaff419438830ab6d55830af2f26b87 to your computer and use it in GitHub Desktop.
Save danielsdeboer/3aaff419438830ab6d55830af2f26b87 to your computer and use it in GitHub Desktop.
Run PHPUnit, disabling Xdebug before execution, preserving arguments.
<?php
require 'vendor/autoload.php';
use Composer\XdebugHandler\XdebugHandler;
/*
* Check if Xdebug is enabled and disable it.
*/
$xdebug = new XdebugHandler('no-prefix');
$xdebug->check();
unset($xdebug);
/*
* Unset the first argument, the name of the script.
*/
unset($argv[0]);
$command = new PHPUnit_TextUI_Command();
/*
* Run PHPUnit, passing all the arguments in.
*/
$command->run(array_merge(['phpunit'], $argv));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment