PSpec 是一个现代的、基于BDD风格的PHP测试框架。

v1.0.0-alpha 2016-06-30 17:46 UTC

This package is auto-updated.

Last update: 2024-09-06 17:21:29 UTC


README

Build Status Latest Stable Version

PSpec 是一个现代的、基于BDD风格的PHP测试框架,它使用简单、会话式的DSL和表达性、流畅的断言,使您能够编写更易于阅读的测试。

describe('string functions', function () {
    describe('strtolower', function () {
        it('should return a string with all its characters lower case', function () {
            expect(strtolower('PSpec'))->toEqual('pspec');
        });
    });

    describe('strpos', function () {
        context('when needle is found', function () {
            it('should return the first character index of needle within haystack', function () {
                expect(strpos('PSpec', 'Spec'))->toBe(1);
            });
        });

        context('when needle is not found', function () {
            it('should return false', function () {
                expect(strpos('PSpec', 'PHP'))->toBeFalse();
            });
        });
    });
});

安装

使用 Composer 将 PSpec 作为 开发 依赖项安装到您的项目中

composer require --dev jasonmccreary/pspec:1.*@alpha

用法

使用 pspec 命令运行您的测试

vendor/bin/pspec

文档

文档和附加示例将在官方版本中提供。

许可证

PSpec 是开源软件,许可协议为 MIT 许可证

感谢

PSpec 是在 matura 的基础上构建的,并深受 RSpecJasmine 的启发。我要感谢这些项目。