Giter VIP home page Giter VIP logo

kahlan's Introduction

Kahlan


Build Status Build Status HHVM Status License

Latest Stable Version Total Downloads Code Climate Coverage Status Coveralls Coverage Status Scrutinizer Coverage Status

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.

Kahlan embraces the KISS principle and makes Unit & BDD testing fun again!

Killer feature: Kahlan allows to stub or monkey patch your code directly like in Ruby or JavaScript without any required PECL-extentions.

Video

IRC

chat.freenode.net (server) #kahlan (channel)

Documentation

See the whole documentation here (documentation for Kahlan <= 1.3.0 can still be found here)

Requirements

  • PHP 5.5+
  • Composer
  • Xdebug (if you want to perform code coverage analysis)

Main Features

  • Simple API
  • 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 class/instances
  • Built-in Reporters (Terminal or HTML reporting through istanbul or lcov)
  • Built-in Exporters (Coveralls, Code Climate, Scrutinizer, Clover)
  • Extensible, customizable workflow
  • Small code base (~10 times smaller than PHPUnit)

Syntax

describe("Example", function() {

    it("passes if true === true", function() {

        expect(true)->toBe(true);

    });

    it("passes if false !== true", function() {

        expect(false)->not->toBe(true);

    });

});

Screenshots

Example of default reporting:

dot_reporter

Example of verbose reporting:

verbose_reporter

Example of code coverage on a specific scope:

code_coverage

Installation

via Composer

$ composer require --dev crysalead/kahlan

Note: Kahlan uses the ferver versioning so a "~x.y" version constraint shouldn't ever BC-break.

via Git clone

git clone git://github.com/crysalead/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)

kahlan's People

Contributors

jails avatar m1ome avatar samsonasik avatar rnijveld avatar lostkobrakai avatar ddziaduch avatar liamjcrewe avatar blazej-pachut-gforces avatar fabschurt avatar phishy avatar umpirsky avatar thattomperson avatar wms avatar myselff avatar tyranron avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.