highly extensible, highly enjoyable, BDD testing framework for PHP.
Peridot Events
Peridot features an event driven architecture. This has not only greatly simplified Peridot's own source code, it also allows testers to easily customize Peridot via plugins and reporters. The Peridot event emitter can be accessed via the peridot.php file:
<?php //peridot.php
use Evenement\EventEmitterInterface;
use Peridot\Core\Test;
return function(EventEmitterInterface $emitter) {
$emitter->on('test.failed', function (Test $test) {
//log the failure?
//abort abort abort?
//let your loved ones know about your shortcomings?
});
}The following events are available for your testing pleasure:
-
peridot.startFires when the Peridot application is constructed. Useful for defining additional CLI arguments and options.
Arguments:
Environment$environment
Application$application -
peridot.configureFires when the Peridot application is configured. Useful for overriding configuration values and configuring the Peridot test runner.
Arguments:
Configuration$configuration
Application$application -
peridot.executeFires right before Peridot starts execution. Happens after CLI options are parsed and before specs are loaded.
Arguments:
InputInterface$input
OutputInterface$output -
peridot.reportersFires when Peridot reporters are registered. Useful for registering additional reporters.
Arguments:
InputInterface$input
ReporterFactory$reporters
-
peridot.loadFires right before Peridot starts loading tests. Useful for changing loading behavior.
Arguments:
Command$command
Configuration$configuration
-
peridot.endFires when the Peridot application exits.
Arguments:
integer$exitCode
InputInterface$input
OutputInterface$output -
runner.startFires right before the suite runner starts.
Arguments: No arguments
-
runner.endFires right after the suite runner ends.
Arguments:
float$runTime -
suite.defineFires right before a suite definition is executed. Ideal for passing arguments to the definition function.
Arguments:
Suite$suite -
suite.startFires right before a suite runs.
Arguments:
Suite$suite -
suite.endFires right after a suite runs.
Arguments:
Suite$suite -
suite.haltWhen fired, this event signals a suite to stop running.
Arguments: No arguments
-
test.passedFires when a test passes.
Arguments:
Test$test -
test.pendingFires when a test pends.
Arguments:
Test$test -
test.failedFires when a test fails.
-
test.startFires right before a test runs.
Arguments:
Test$test -
test.endFires right after a test runs.
Arguments:
Test$test -
errorFires when a PHP error occurs. The standard error arguments passed to a function registered via PHP's native
set_error_handlerwill be passed to this event.Arguments:
integer$errno
string$errstr
string$errfile
string$errline