highly extensible, highly enjoyable, BDD testing framework for PHP.
Testing with Peridot is natural. Write tests using the familiar
describe-it syntax. Easily and clearly describe how your code should behave in a language that makes sense. See getting started.
Peridot can be installed several ways:
Manual install (local)
Peridot uses the familiar
describe-it syntax to create a clear and readable testing language.
Only run tests whose title matches the provided pattern. See Focusing and Skipping.
Only run tests whose title does not match the provided pattern. See Focusing and Skipping.
Only run test files whose filename matches the provided pattern. The default grep pattern is
Tell peridot to stop running tests as soon as there is a failure.
Select which reporter(s) to use (multiple values can be specified). See Specifying Reporters.
List available test reporters.
Disable colors in output.
A path to a peridot configuration file. Defaults to
getcwd() . '/peridot.php'
Focusing and Skipping
See also Focused Specs, which allow you to focus tests without using command line options.
--skip options can be used independently, or combined for complex test isolation.
If both are used,
--skip will take precedence.
The patterns accepted by both of these options are PCRE regular expressions that are evaluated against the "title" of the test.
The test title includes the description of the suite it is contained within, including any ancestors of that suite.
For example, the test shown in Getting Started has a title of:
ArrayObject ->count() should return the number of items.
If the provided pattern is not a complete PCRE regular expression, it will be surrounded in delimiters.
--focus 'foo.*' is equivalent to
If the provided pattern is not a valid PCRE regular expression, it will be treated as plain text.
--focus 'foo(' is equivalent to
The addition of
\b simply prevents accidental matching of substrings.
--reporter option can be used one or more times, and specifies the name of a reporter to use.
Reporter names are registered via ReporterFactory::register.
When multiple reporters are specified, the first reporter specified is the "primary" reporter, and any output generated by this reporter will be displayed as the suite runs. Any subsequent reporters will have their output buffered, and this output will be displayed after the suite has completed.
Example Test Suites
You can head over to the Peridot GitHub organization for plenty of examples using Peridot.
We would love to see other projects using Peridot, so if you have a project that uses it, we would love to know. Feel free to message us and let us know. We will gladly list your project on the site.
Running Peridot's tests
Peridot's tests were written using Peridot. After cloning Peridot, you can run tests using: