2017 © Pedro Peláez
 

library kahlan

Behavior-Driven Development (BDD) library.

image

crysalead/kahlan

Behavior-Driven Development (BDD) library.

  • Wednesday, September 21, 2016
  • by jails
  • Repository
  • 34 Watchers
  • 447 Stars
  • 52,513 Installations
  • PHP
  • 33 Dependents
  • 0 Suggesters
  • 37 Forks
  • 6 Open issues
  • 51 Versions
  • 1 % Grown

The README.md

Kahlan, (*1)


Build Status License, (*2)

Latest Stable Version Total Downloads Code Coverage, (*3)

Kahlan is a full-featured Unit & BDD test framework a la RSpec/JSpec which uses a describe-it syntax and moves testing in PHP one step forward., (*4)

Kahlan lets you stub or monkey patch your code directly like in Ruby or JavaScript without any required PECL-extensions., (*5)

Videos

IRC

chat.freenode.net (server) #kahlan (channel), (*6)

Documentation

See the full documentation here, (*7)

Requirements

  • PHP 7.2+
  • Composer
  • phpdbg or Xdebug (only required for code coverage analysis)

Main Features

  • RSpec/JSpec syntax
  • Code Coverage metrics (xdebug or phpdbg required)
  • Handy stubbing system (mockery or prophecy are no longer needed)
  • Set stubs on your class methods directly (i.e allows dynamic mocking)
  • Ability to Monkey Patch your code (i.e. allows replacement of core functions/classes on the fly)
  • Check called methods on your classes/instances
  • Built-in Reporters (Terminal or HTML reporting through istanbul or lcov)
  • Built-in Exporters (Coveralls, Code Climate, Scrutinizer, Clover)
  • Extensible, customizable workflow

Syntax

<?php

describe("Example", function() {

    it("makes an expectation", function() {

         expect(true)->toBe(true);

    });

    it("expects methods to be called", function() {

        $user = new User();
        expect($user)->toReceive('save')->with(['validates' => false]);
        $user->save(['validates' => false]);

    });

    it("stubs a function", function() {

        allow('time')->toBeCalled()->andReturn(123);
        $user = new User();
        expect($user->save())->toBe(true)
        expect($user->created)->toBe(123);

    });

    it("stubs a class", function() {

        allow('PDO')->toReceive('prepare', 'fetchAll')->andReturn([['name' => 'bob']]);
        $user = new User();
        expect($user->all())->toBe([['name' => 'bob']]);

    });

});

Screenshots

Example of default reporting:

dot_reporter, (*8)

Example of verbose reporting:

verbose_reporter, (*9)

Example of code coverage on a specific scope:

code_coverage, (*10)

Installation

via Composer

$ composer require --dev kahlan/kahlan

Note: Kahlan uses the Semantic Versioning and maintains a CHANGELOG to help you easily understand what's happening., (*11)

via Git clone

git clone git://github.com/kahlan/kahlan.git
cd kahlan
composer install
bin/kahlan              # to run specs or,
bin/kahlan --coverage=4 # to run specs with coverage info for namespaces, classes & methods (require xdebug)

The Versions

21/09 2016

dev-dev

dev-dev

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

18/08 2016

dev-master

9999999-dev

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

18/08 2016

2.5.6

2.5.6.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

13/08 2016

2.5.5

2.5.5.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

15/06 2016

2.5.4

2.5.4.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

10/05 2016

2.5.3

2.5.3.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

02/05 2016

1.3.x-dev

1.3.9999999.9999999-dev

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

02/05 2016

1.3.2

1.3.2.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

01/05 2016

2.5.2

2.5.2.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

01/05 2016

2.5.1

2.5.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

28/04 2016

2.5.0

2.5.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

23/03 2016

2.4.1

2.4.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

20/03 2016

2.4.0

2.4.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

18/02 2016

2.3.2

2.3.2.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

13/02 2016

2.3.1

2.3.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

10/02 2016

2.3.0

2.3.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

10/02 2016

2.2.0

2.2.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

17/01 2016

2.1.0

2.1.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

09/12 2015

1.3.1

1.3.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

09/12 2015

2.0.1

2.0.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

06/12 2015

2.0.0

2.0.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

05/12 2015

1.3.0

1.3.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

24/11 2015

1.2.11

1.2.11.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

23/11 2015

1.2.10

1.2.10.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

23/11 2015

1.2.9

1.2.9.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

22/11 2015

1.2.8

1.2.8.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

07/11 2015

1.2.7

1.2.7.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

07/11 2015

1.2.6

1.2.6.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

04/11 2015

1.2.5

1.2.5.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

03/11 2015

1.2.4

1.2.4.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

03/11 2015

1.2.3

1.2.3.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

22/10 2015

1.2.2

1.2.2.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

17/10 2015

1.2.1

1.2.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

13/10 2015

1.2.0

1.2.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

03/09 2015

1.1.9

1.1.9.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

30/07 2015

1.1.8

1.1.8.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

27/07 2015

1.1.7

1.1.7.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

27/07 2015

1.1.6

1.1.6.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

26/06 2015

1.1.5

1.1.5.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

04/06 2015

1.1.4

1.1.4.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

21/03 2015

1.1.3

1.1.3.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

20/03 2015

1.1.2

1.1.2.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

17/03 2015

1.1.1

1.1.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

25/02 2015

1.1.0

1.1.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

11/02 2015

1.0.6

1.0.6.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

10/02 2015

1.0.5

1.0.5.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

02/02 2015

1.0.4

1.0.4.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

02/02 2015

1.0.3

1.0.3.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

01/02 2015

1.0.2

1.0.2.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

28/01 2015

1.0.1

1.0.1.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development

24/01 2015

1.0.0

1.0.0.0

Behavior-Driven Development (BDD) library.

  Sources   Download

MIT

The Requires

 

by CrysaLEAD

bdd tdd mock stub testing unit test monkey patching behavior-driven development