2017 © Pedro PelĂĄez
 

library praspel-extension

Include Praspel inside atoum.

image

atoum/praspel-extension

Include Praspel inside atoum.

  • Friday, February 24, 2017
  • by Hoa
  • Repository
  • 7 Watchers
  • 5 Stars
  • 13,918 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 11 Versions
  • 1 % Grown

The README.md

atoum/praspel-extension

This extension introduces Praspel inside atoum., (*1)

atoum is a simple, modern and intuitive unit testing framework for PHP!, (*2)

Hoa is a modular, extensible and structured set of PHP libraries. Moreover, Hoa aims at being a bridge between industrial and research worlds., (*3)

Installation

With Composer, to include this library into your dependencies, you need to require atoum/praspel-extension:, (*4)

composer require --dev atoum/praspel-extension

Please, read the website to get more informations about how to install., (*5)

And to activate the extension, add this line on your .atoum.php configuration file:, (*6)

$runner->addExtension(new \Atoum\PraspelExtension\Manifest());

Quick usage

This extension brings two aspects into atoum: automatic test data generation (from Hoa\Realdom) and automatic test suite generation (from Hoa\Praspel, which relies on Hoa\Realdom)., (*7)

Automatic test data generation

[more explications needed] We will use three asserters to generate data and one to validate data:, (*8)

  1. realdom to create a realistic domains disjunction,
  2. sample to generate one data from a realistic domains disjunction,
  3. sampleMany to generate several data,
  4. predicate to validate a data against a realistic domains disjunction.

As an example, we are going to generate an integer defined by: [7; 13] âˆȘ [42; 153]:, (*9)

$this->sample($this->realdom->boundinteger(7, 13)->or->boundinteger(42, 153))

We can obviously use the classical asserters from atoum:, (*10)

foreach ($this->sampleMany($this->realdom->boundinteger(-5, 5), 1024) as $i) {
    $this->integer($i)->isGreaterThan(0);
}

(this example is a little dummy ;-))., (*11)

We can generate more sophisticated data (please, see the standard realistic domain library in Hoa\Realdom), such as strings based on regular expressions (and also grammars):, (*12)

$data = $this->realdom->regex('/[\w\-_]+(\.[\w\-\_]+)*@\w\.(net|org)/');
$this->string($this->sample($data))
     ->contains(
)->
;

Or even dates:, (*13)

$data = $this->realdom->date(
    'd/m H:i',
    $this->realdom->boundinteger(
        $this->realdom->timestamp('yesterday'),
        $this->realdom->timestamp('next Monday')
    )
);

foreach ($this->sampleMany($data, 10) as $date) {
    var_dump($date);
}

Automatic test suite generation

We will use the Bin/praspel binary script. [TODO], (*14)

Documentation of Hoa

Different documentations can be found on the website: https://hoa-project.net/., (*15)

License

Hoa, along with this extension, is under the New BSD License (BSD-3-Clause). Please, see LICENSE., (*16)

atoum + Hoa, (*17)

The Versions

17/01 2016
11/01 2016
20/02 2015

0.15.02.20

0.15.02.20 http://hoa-project.net/

Include Praspel inside atoum.

  Sources   Download

BSD-3-Clause

The Requires

 

test library specification data assertion generation checker contract atoum praspel

18/02 2015

0.15.02.18

0.15.02.18 http://hoa-project.net/

Include Praspel inside atoum.

  Sources   Download

BSD-3-Clause

The Requires

 

test library specification data assertion generation checker contract atoum praspel

01/12 2014

0.14.12.01

0.14.12.01 http://hoa-project.net/

Include Praspel inside atoum.

  Sources   Download

BSD-3-Clause

The Requires

 

test library specification data assertion generation checker contract atoum praspel

25/11 2014

0.14.11.25

0.14.11.25 http://hoa-project.net/

Include Praspel inside atoum.

  Sources   Download

BSD-3-Clause

The Requires

 

test library specification data assertion generation checker contract atoum praspel

17/09 2014

0.14.09.24

0.14.09.24 http://hoa-project.net/

Include Praspel inside atoum.

  Sources   Download

BSD-3-Clause

The Requires

 

test library specification data assertion generation checker contract atoum praspel