Logo: Relish

  1. Sign in

Project: Dspec

Getting Started


The only documented way to install dspec is with Composer

$ composer.phar require --dev davedevelopment/dspec:*


Create a Spec file


// BowlingSpec.php

require_once 'Bowling.php';
require_once 'hamcrest/Hamcrest.php';

describe("Bowling", function() {

    beforeEach(function() {                                  // run before every sibling and descendant it() 
        $this->bowling = new Bowling;                        // PHP 5.4's closure binding allows the use of this

    it("should score zero for gutter game", function() {
        for ($i = 0; $i < 20; $i++) {

        assertThat($this->bowling->score, equalTo(0));      // hamcrest assertion


Run it

$ vendor/bin/dspec BowlingSpec.php

Last published over 5 years ago by Dave Marshall.