joeforshaw/speckl

该软件包最新版本(dev-main)没有可用的许可信息。

dev-main 2021-08-22 20:33 UTC

This package is auto-updated.

Last update: 2024-09-23 03:04:47 UTC


README

Speckl 是一个PHP测试框架,它提供了与 Mocha、Jest 和 RSpec(仅举几个例子)相同的优雅结构。它提供了一个面向BDD的describe/it接口,允许您优雅地阐述您要测试的内容。

示例

class Dog {
  public $isHappy;

  public function isGood() {
    return true;
  }

  public function tailIsWagging() {
    return $this->isHappy;
  }
}

describe(Dog::class, function() {
  beforeEach(function() {
    $this->dog = new Dog();
  });

  context('when the dog is happy', function() {
    it("wags it's tail", function() {
      $this->dog->isHappy = true;
      expect($this->dog->tailIsWagging())->to->equal(true);
    });
  });

  it('is a good doggo', function() {
    expect($this->dog->isGood())->to->equal(true);
  });

  it('is a bad doggo', function() {
    expect($this->dog->isGood())->to->equal(false);
  });
});

功能

定义测试

上下文

测试生命周期

共享代码

路线图

  • 更好的文档