8000 GitHub - speciphy/speciphy: xSpec BDD framework for PHP. · GitHub
[go: up one dir, main page]

Skip to content
speciphyPublic

About

xSpec BDD framework for PHP.

Resources

Stars

14 stars

Watchers

1 watching

Forks

Repository files navigation

Speciphy

master: Build Status develop: Build Status

xSpec BDD Framework for PHP.

Strongly inspired from RSpec.

Features

  • Nested context
  • Specification with string
  • Expectation DSL provided by Espérance

Why I make this

I like both PHPUnit and PHPSpec, but I think they have common issue.

  • No nested context
  • Specification with camelCase or lower_case_with_underscore method name

These are very messy.

PHP Development should be more enjoyable.

I have proposal (see below) and Speciphy shows working example.

Proposal for xSpec BDD Framework for PHP

  1. Use function in namespace, Not method in class
  2. Use array to build nested structure (Deprecated since 0.1.0)

More details are in below slide.

http://www.slideshare.net/taketyan/proposal-for-xspep-bdd-framework-for-php

Example

<?php
namespace Speciphy\DSL;

return
describe('Bowling',
    describe('->score',
        context('all gutter game',
            subject(function () {
                $bowling = new Bowling;
                for ($i = 1; $i <= 20; $i++) {
                    $bowling->hit(0);
                }
                return $bowling;
            }),

            it('should equal 0', function ($bowling) {
                expect($bowling->score)->to->be(0);
            })
        )
    )
);

Author

Yuya Takeyama

About

xSpec BDD framework for PHP.

Resources

Stars

14 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0