2017 © Pedro Peláez
 

library unit-test-lite

A light unit test class providing basic test function and beautiful report.

image

elfstack/unit-test-lite

A light unit test class providing basic test function and beautiful report.

  • Thursday, August 25, 2016
  • by Tamce
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Unit

ElfStack\Unit is a easy-to-use unit test class, not providing much function but light and easy., (*1)

Quick overview

Let's see a code example:, (*2)

use ElfStack\Unit;

$unit = new Unit();

$unit->start('Unit test group name(can be null)');

$str = 'Hello World!';
$unit->describe('First way to use', 'Here comes more info')->expect($str)->toBe('Hello World');

$unit->describe('Simple compare', 'You can also use not to be')->expect($str)->notToBe(null);

$unit->assertEqual('You can also use this way to run a test', $str, 'Hello World!', 'More info comes here now');

$unit->assertUnequal('Unequal method', $str, null);

$unit->assert('You can use user defined functions too.', function () use ($str) {
    echo 'Output in function will shows too.';
    return $str == true;
}, 'Any function call be recognized by `is_callable` can be called.<br>The function\'s output and return value are displayed as `Expected` and `Got`.');

$unit->printResult();


$unit->start();
$var = 1 + 1;
$unit->assertEqual('You can use `start` method to start another group of unit test.', $var, 2,
                         'You can print result in one page too.<br>You can use `result` method to get result without output it.');
echo $unit->result();

And you will got(show as 67%):, (*3)

Unit Test Report, (*4)

Usage

composer require elfstack/unit-test-light

The Versions

25/08 2016

dev-master

9999999-dev https://github.com/elfstack/unit-test-lite

A light unit test class providing basic test function and beautiful report.

  Sources   Download

MIT

by Avatar Tamce

test tests unit unit-test unit test

25/08 2016

v0.1.3

0.1.3.0 https://github.com/elfstack/unit-test-lite

A light unit test class providing basic test function and beautiful report.

  Sources   Download

MIT

by Avatar Tamce

test tests unit unit-test unit test