Skip to content

Instantly share code, notes, and snippets.

@mdarse
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdarse/4028dffd9bb5fdb57889 to your computer and use it in GitHub Desktop.
Save mdarse/4028dffd9bb5fdb57889 to your computer and use it in GitHub Desktop.
PHPUnit global notifier
#!/bin/bash
alias phpunit="phpunit --bootstrap bootstrap_listener.php"
<?php
PHPUnitNotifier\ConfigurationOverride::setup();
<?php
namespace PHPUnitNotifier;
use LogicException;
use PHPUnit_Util_Configuration as Configuration;
class ConfigurationOverride
{
public static function setup()
{
runkit_method_rename(Configuration::class, 'getListenerConfiguration', '__wrapped__getListenerConfiguration');
runkit_method_copy(Configuration::class , 'getListenerConfiguration' , self::class);
}
private function __construct() {}
public function getListenerConfiguration()
{
$listeners = $this->__wrapped__getListenerConfiguration();
$listeners[] = [
'class' => NotifierListener::class,
'file' => '',
'arguments' => []
];
return $listeners;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment