All Projects → kahlan → Kahlan

kahlan / Kahlan

Licence: mit
✔️ PHP Test Framework for Freedom, Truth, and Justice

Projects that are alternatives of or similar to Kahlan

Shellspec
A full-featured BDD unit testing framework for bash, ksh, zsh, dash and all POSIX shells
Stars: ✭ 375 (-64.79%)
Mutual labels:  test, tdd, coverage, bdd
Should Enzyme
Useful functions for testing React Components with Enzyme.
Stars: ✭ 41 (-96.15%)
Mutual labels:  test, tdd, bdd
Mocha
☕️ simple, flexible, fun javascript test framework for node.js & the browser
Stars: ✭ 20,986 (+1870.52%)
Mutual labels:  test, tdd, bdd
List Of Testing Tools And Frameworks For .net
✅ List of Automated Testing (TDD/BDD/ATDD/SBE) Tools and Frameworks for .NET
Stars: ✭ 303 (-71.55%)
Mutual labels:  tdd, coverage, bdd
bdd-for-c
A simple BDD library for the C language
Stars: ✭ 90 (-91.55%)
Mutual labels:  tdd, test, bdd
Snap Shot It
Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
Stars: ✭ 138 (-87.04%)
Mutual labels:  test, tdd, bdd
Alsatian
TypeScript testing framework with test cases
Stars: ✭ 244 (-77.09%)
Mutual labels:  test, tdd, coverage
Should.js
BDD style assertions for node.js -- test framework agnostic
Stars: ✭ 1,908 (+79.15%)
Mutual labels:  test, tdd, bdd
framework
Lightweight, open source and magic-free framework for testing solidity smart contracts.
Stars: ✭ 36 (-96.62%)
Mutual labels:  tdd, test, spec
Aruba
Test command-line applications with Cucumber-Ruby, RSpec or Minitest. The most up to date documentation can be found on Cucumber.Pro (https://app.cucumber.pro/projects/aruba)
Stars: ✭ 900 (-15.49%)
Mutual labels:  test, tdd, bdd
Jgiven
Behavior-Driven Development in plain Java
Stars: ✭ 319 (-70.05%)
Mutual labels:  tdd, bdd
Baretest
An extremely fast and simple JavaScript test runner.
Stars: ✭ 364 (-65.82%)
Mutual labels:  tdd, bdd
Kitchen In Travis
Chef cookbook example to run test-kitchen inside Travis CI.
Stars: ✭ 36 (-96.62%)
Mutual labels:  tdd, spec
Lest
A modern, C++11-native, single-file header-only, tiny framework for unit-tests, TDD and BDD (includes C++98 variant)
Stars: ✭ 316 (-70.33%)
Mutual labels:  tdd, bdd
Ginkgo
BDD Testing Framework for Go
Stars: ✭ 5,346 (+401.97%)
Mutual labels:  test, bdd
Everydayrails Rspec 2017
Sample source for the 2017 edition of Everyday Rails Testing with RSpec.
Stars: ✭ 280 (-73.71%)
Mutual labels:  tdd, bdd
Testfx
MSTest V2 framework and adapter
Stars: ✭ 391 (-63.29%)
Mutual labels:  test, tdd
Ut
UT: C++20 μ(micro)/Unit Testing Framework
Stars: ✭ 507 (-52.39%)
Mutual labels:  tdd, bdd
Specs2
Software Specifications for Scala
Stars: ✭ 696 (-34.65%)
Mutual labels:  test, bdd
Public
Repository for wallaby.js questions and issues
Stars: ✭ 662 (-37.84%)
Mutual labels:  tdd, bdd

Kahlan


Build Status Build 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 lets you stub or monkey patch your code directly like in Ruby or JavaScript without any required PECL-extensions.

Videos

IRC

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

Documentation

See the full documentation here

Requirements

  • PHP 7.1+
  • 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

Example of verbose reporting:

verbose_reporter

Example of code coverage on a specific scope:

code_coverage

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.

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)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].