事件驱动的PHP测试框架:Peridot
jopen
10年前
Peridot 是一个现代支持 PHP 5.4+ 的测试框架。它能够让测试变得有趣。它还能够轻松扩展通一个很棒的事件系统,让开发者可以创建插件,自定义测试报告等。
特性:
- Flexible testing interface
- Event driven plugin architecture
- Easily add user defined cli options
- Easily create custom test reporters
- Pass/fail based on exceptions
- Mix in functionality via child scopes
- Create your own testing DSLs
示例:
<?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)