2017 © Pedro Peláez
 

library hhspecify

BDD testing framework for Hack

image

hhspecify/hhspecify

BDD testing framework for Hack

  • Thursday, October 1, 2015
  • by holyshared
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • Hack
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

HHSpecify

Build Status, (*1)

HHSpecify is BDD testing framework for Hack, inspired by spock., (*2)

Screen Shot, (*3)

Installation

Installed by composer., (*4)

composer require hhspecify/hhspecify

Basic usage

Create a configuration file

Create a configuration file in order to verify the specifications.
Use the configure method to do the setup., (*5)

<?hh //partial

use hhspecify\HHSpecify;
use hhspecify\config\ConfigBuilder;
use hhspecify\reporter\SpecificationReporter;

HHSpecify::configure((ConfigBuilder $builder) ==> {

    $package = shape(
        'namespace' => 'vendorname\\spec\\', //The package namespace of the spec
        'packageDirectory' => __DIR__ . '/spec' //The directory of the package spec
    );

    $builder->package($package)
        ->featureReporter(new SpecificationReporter());

});

Create a specification file

It will create a specification file to vendorname/spec.
Specification must implement hhspecify\Specification., (*6)

It will specify the specification in the Feature attribute., (*7)

use hhspecify\Specification;
use hhspecify\feature\FeatureVerifierBuilder as Feature;

final class StackSpec implements Specification
{

    public function __construct(
        private Stack<int> $stack = new Stack()
    )
    {
    }

    <<Feature("Stack::add")>>
    public function add_value_to_stack(Feature $feature) : void
    {
    }
}

Write a feature specification

It will describe the setup / when / then block.
Block specified in lambda expression., (*8)

<<Feature("Stack::add")>>
public function add_value_to_stack(Feature $feature) : void
{
    //setup block - Setup
    $feature->setup(() ==> {
        $this->stack = new Stack();
    });

    //when block - Stimulus
    $feature->when(() ==> {
        $this->stack->add(1);
    });

    //then block - Response
    $feature->then(() ==> {
        invariant($this->stack->count() === 1, 'must have been added value');
    });
}

Verify the specification

In the package root directory run the following command., (*9)

vendor/bin/hhspecify

Run the test

composer install
composer test

Run the example

composer install
composer example

The Versions

01/10 2015

dev-master

9999999-dev

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.6.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

01/10 2015

0.1.2

0.1.2.0

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.6.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

12/06 2015

0.1.1

0.1.1.0

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

12/06 2015

0.1

0.1.0.0

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

09/06 2015

0.1.1-alpha4

0.1.1.0-alpha4

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

08/06 2015

0.1-alpha4

0.1.0.0-alpha4

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

05/06 2015

0.1.1-alpha3

0.1.1.0-alpha3

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

04/06 2015

0.1-alpha3

0.1.0.0-alpha3

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

03/06 2015

0.1-alpha2

0.1.0.0-alpha2

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm

03/06 2015

0.1-alpha

0.1.0.0-alpha

BDD testing framework for Hack

  Sources   Download

MIT

The Requires

  • hhvm >=3.5.0

 

The Development Requires

by Avatar holyshared

bdd test spec hack hhvm