Skip to content

robindrost/Testify.php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Testify.php - a micro unit testing framework

Testify makes writing unit tests fun again. It has an elegant syntax and keeps things simple.

Here is an example for a test suite with two test cases:

include "testify/testify.class.php";
include "MyCalc.php";

$tf = new Testify("MyCalc Test Suite");

$tf->beforeEach(function($tf){
	$tf->data->calc = new MyCalc(10);
});

$tf->test("Testing the add() method", function($tf){
	$calc = $tf->data->calc;
	
	$calc->add(4);
	$tf->assert($calc->result() == 14);

	$calc->add(-5);
	$tf->assertEqual($calc->result(),9);
});

$tf->test("Testing the mul() method", function($tf){
	$calc = $tf->data->calc;
	
	$calc->mul(1.5);
	$tf->assertEqual($calc->result(),15);

	$calc->mul(-1);
	$tf->assertEqual($calc->result(),-15);
});

$tf->run();

For full documentation and a getting started guide, visit the Testify homepage.

About

A micro unit testing framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published