Peridot PHP 测试框架 项目简介
Peridot 是一个支持 PHP 5.4+ 的高可扩展、用起来很方便的 PHP 测试框架。Peridot 让测试更加有趣。开发者可以创建插件,自定义测试报告等。特性:灵活的测试接口 事件驱动的插件架构 可轻松添加用户定义的命令行参数 轻松创建自定义测试报告 基于异常的 Pass/fail 通过子范围实现功能混入 可创建你自己的测试 DSL示例:<?php //arrayobject.spec.php
describe('ArrayObject', function() {
beforeEach(function() {
$this->arrayObject = new ArrayObject(['one', 'two', 'three']);
});
describe('->count()', function() {
it("should return the number of items", function() {
$count = $this->arrayObject->count();
assert($count === 3, "expected 3");
});
});
});
?>
$ peridot arrayobject.spec.php
ArrayObject
->count()
✓ should return the number of items
1 passing (19 ms)
describe('ArrayObject', function() {
beforeEach(function() {
$this->arrayObject = new ArrayObject(['one', 'two', 'three']);
});
describe('->count()', function() {
it("should return the number of items", function() {
$count = $this->arrayObject->count();
assert($count === 3, "expected 3");
});
});
});
?>
$ peridot arrayobject.spec.php
ArrayObject
->count()
✓ should return the number of items
1 passing (19 ms)