protected function assertDoesNotEmitEvent($type, array $args = array())
{
// Ugly hack to get around an issue in PHPUnit
// @link http://github.com/sebastianbergmann/phpunit-mock-objects/issues/issue/5#issue/5/comment/343524
$callback = create_function('$plugin, $type, $args', 'if (get_class($plugin) == "' . $this->pluginClass . '"
&& $type == "' . $type . '"
&& $args == "' . var_export($args, true) . '") {
trigger_error("Instance of ' . $this->pluginClass . ' unexpectedly emitted event of type ' . $type . '", E_USER_ERROR);
}');
$this->events->expects($this->any())->method('addEvent')->will($this->returnCallback($callback));
}