joeforshaw/speckl

There is no license information available for the latest version (dev-main) of this package.

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

This package is auto-updated.

Last update: 2024-12-23 03:26:36 UTC


README

Speckl is a PHP testing framework that provides the same elegant structure as Mocha, Jest and RSpec (to name a few). It provides a BDD-oriented describe/it interface that allows you to eloquently articulate what you're looking to test.

Example

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);
  });
});

Features

Defining a test

Contexts

Test lifecyles

Sharing code

Roadmap

  • Better documentation