Skip to content
brianium edited this page Nov 8, 2014 · 10 revisions

At the heart of Peridot is an event system powered by Événement. We chose Événement for it's simplicity, and it is a key player in the simplicity of Peridot plugin development.

You can leverage all of Peridot's events via a peridot.php file placed in the current working directory from where you run your tests, or by specifying a path to one using the -c or --configuration switches from the command line.

//peridot.php
use Evenement\EventEmitterInterface;

//if peridot.php returns a function, that function will be executed.
return function(EventEmitterInterface $emitter) {
    $emitter->on('test.failed', function($test) {
        //do something with $test
    });
};

##Event Reference

The following is a list of all the events that Peridot uses, and the arguments that are included with them.

###peridot.start Fires when the Peridot application is first constructed. This event is useful for defining additional CLI arguments and options. This is how the watcher plugin adds the --watch option to Peridot.

Event Arguments:

###peridot.configure Fires after the Peridot application is configured.

Event Arguments:

###peridot.execute Fires right before Peridot starts execution. Happens after CLI options are parsed and before specs are loaded.

Event Arguments:

###peridot.reporters Fires when Peridot reporters are registered. Useful for registering additional reporters.

Event Arguments:

###peridot.load Fires right before Peridot starts loading tests. Useful for changing loading behavior.

Event Arguments:

Clone this wiki locally