highly extensible, highly enjoyable, BDD testing framework for PHP.
Plugins
Peridot exposes a handful of events that can be hooked into via a configuration file. This mechanism is the easiest, and preferred way by which Peridot is extended. A core design goal of Peridot is to keep the core framework as lean as possible - while opening up a ton of possibilities via events, scopes, and dsls.
Peridot will look for a file called peridot.php
in the current working directory, or one can be specified using the --configuration
option via the console. The configuration file will be included once, and it should return a function that accepts a single EventEmitter containing ->on()
and ->emit()
methods.
The Peridot team has leveraged this mechanism already to create some really cool plugins:
-
This plugin adds command line options for running your suites concurrently. A great plugin for large and slow integration or functional tests.
-
The HttpKernel plugin simplifies testing with frameworks like Symfony, Silex, or Laravel. The plugin exposes a
Symfony\Component\HttpKernel\Client
to your suites. -
The prophecy plugin integrates the amazing mocking library prophecy. The plugin makes a prophet objet available to tests, and also supports auto mocking of class names in
describe
blocks. -
The watcher plugin will watch changes to tests and source files. When a change is detected, the watcher plugin will re-run your tests.
Reporters
Peridot ships with a spec reporter for printing test results in a hierarchal manner. However, you can easily create your own reporters.
Reporters can be registered via the configuration file like any other plugin through the peridot.reporters
event. Plugin authors can create reporters to support their added functionality, or reporters can be created as standalone plugins themselves. Check out some of the additional reporters created by the Peridot team:
-
The dot reporter provides a simple dot matrix that would be familar to most PHPUnit users.
-
The list reporter lists test titles from top to bottom using colors to convey pass/fail status.
-
This plugin provides a set of reporters for generating code coverage for test suites.
-
The peridot-concurrency plugin comes with it's own reporter for displaying results for concurrently run suites.
Check out Peridot's own peridot.php file for an example of creating a custom reporter.