Unit test library.

package lime
author Fabien Potencier
version SVN: $Id: lime.php 29529 2010-05-19 13:41:48Z fabien $

 Methods

__construct()

__construct($plan, $options) 

Parameters

$plan

$options

__destruct()

__destruct() 

Checks the availability of a method for an object or a class

can_ok(mixed $object, string | array $methods, string $message) : boolean

Parameters

$object

mixed

an object instance or a class name

$methods

stringarray

one or more method names

$message

string

display output message when the test passes

Returns

boolean

Compares two arguments with an operator

cmp_ok(mixed $exp1, string $op, mixed $exp2, string $message) : boolean

Parameters

$exp1

mixed

left value

$op

string

operator

$exp2

mixed

right value

$message

string

display output message when the test passes

Returns

boolean

comment()

comment($message) 

Parameters

$message

Outputs a diag message but runs no test

diag(string $message) : void

Parameters

$message

string

display output message

error()

error($message, $file, $line, array $traces) 

Parameters

$message

$file

$line

$traces

Always fails--useful for testing exceptions

fail(string $message) : false

Parameters

$message

string

display output message

Returns

false

handle_error()

handle_error($code, $message, $file, $line, $context) 

Parameters

$code

$message

$file

$line

$context

handle_exception()

handle_exception(Exception $exception) 

Parameters

$exception

Validates that a file exists and that it is properly included

include_ok(string $file, string $message) : boolean

Parameters

$file

string

file path

$message

string

display output message when the test passes

Returns

boolean

info()

info($message) 

Parameters

$message

Compares two values and passes if they are equal (==)

is(mixed $exp1, mixed $exp2, string $message) : boolean

Parameters

$exp1

mixed

left value

$exp2

mixed

right value

$message

string

display output message when the test passes

Returns

boolean

Checks that two arrays have the same values

is_deeply(mixed $exp1, mixed $exp2, string $message) : boolean

Parameters

$exp1

mixed

first variable

$exp2

mixed

second variable

$message

string

display output message when the test passes

Returns

boolean

Checks the type of an argument

isa_ok(mixed $var, string $class, string $message) : boolean

Parameters

$var

mixed

variable instance

$class

string

class or type name

$message

string

display output message when the test passes

Returns

boolean

Compares two values and passes if they are not equal

isnt(mixed $exp1, mixed $exp2, string $message) : boolean

Parameters

$exp1

mixed

left value

$exp2

mixed

right value

$message

string

display output message when the test passes

Returns

boolean

Tests a condition and passes if it is true

ok(mixed $exp, string $message) : boolean

Parameters

$exp

mixed

condition to test

$message

string

display output message when the test passes

Returns

boolean

Always passes--useful for testing exceptions

pass(string $message) : true

Parameters

$message

string

display output message

Returns

true

reset()

reset() 

to_array()

to_array() 

to_xml()

to_xml($results) 

Parameters

$results

Counts as a test--useful for tests yet to be written

todo(string $message) : void

Parameters

$message

string

display output message

Checks that a string doesn't match a regular expression

unlike(string $exp, string $regex, string $message) : boolean

Parameters

$exp

string

value to test

$regex

string

the pattern to search for, as a string

$message

string

display output message when the test passes

Returns

boolean

find_caller()

find_caller($traces) 

Parameters

$traces

set_last_test_errors()

set_last_test_errors(array $errors) 

Parameters

$errors

update_stats()

update_stats() 

test_is_deeply()

test_is_deeply($var1, $var2) 

Parameters

$var1

$var2

 Properties

 

$all_results

$all_results 

 

$options

$options 

 

$output

$output 

 

$results

$results 

 

$test_nb

$test_nb 

 Constants

 

EPSILON

EPSILON