事件驅動的PHP測試框架:Peridot

jopen 11年前發布 | 20K 次閱讀 Peridot 單元測試

事件驅動的PHP測試框架:Peridot
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)

項目主頁:http://www.baiduhome.net/lib/view/home/1413852202934

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!