PHP Class CI_Unit_test, TastyIgniter

Exibir arquivo Open project: tastyigniter/tastyigniter Class Usage Examples

Public Properties

Property Type Description
$active boolean Active flag
$results array Test results
$strict boolean Whether to use === or == when comparing

Protected Properties

Property Type Description
$_template string Template
$_template_rows string Template rows
$_test_items_visible array List of visible test items

Public Methods

Method Description
__construct ( ) : void Constructor
active ( $state = TRUE ) : void Make Unit testing active
report ( array $result = [] ) : string Generate a report
result ( array $results = [] ) : array Result Array
run ( mixed $test, mixed $expected = TRUE, string $test_name = 'undefined', string $notes = '' ) : string Run the tests
set_template ( $template ) : void Set the template
set_test_items ( array $items ) : void Run the tests
use_strict ( boolean $state = TRUE ) : void Use strict comparison

Protected Methods

Method Description
_backtrace ( ) : array Generate a backtrace
_default_template ( ) : string Get Default Template
_parse_template ( ) : void Parse Template

Method Details

__construct() public method

Constructor
public __construct ( ) : void
return void

_backtrace() protected method

This lets us show file names and line numbers
protected _backtrace ( ) : array
return array

_default_template() protected method

Get Default Template
protected _default_template ( ) : string
return string

_parse_template() protected method

Harvests the data within the template {pseudo-variables}
protected _parse_template ( ) : void
return void

active() public method

Enables/disables unit testing
public active ( $state = TRUE ) : void
return void

report() public method

Displays a table with the test data
public report ( array $result = [] ) : string
$result array
return string

result() public method

Returns the raw result data
public result ( array $results = [] ) : array
$results array
return array

run() public method

Runs the supplied tests
public run ( mixed $test, mixed $expected = TRUE, string $test_name = 'undefined', string $notes = '' ) : string
$test mixed
$expected mixed
$test_name string
$notes string
return string

set_template() public method

This lets us set the template to be used to display results
public set_template ( $template ) : void
return void

set_test_items() public method

Runs the supplied tests
public set_test_items ( array $items ) : void
$items array
return void

use_strict() public method

Causes the evaluation to use === rather than ==
public use_strict ( boolean $state = TRUE ) : void
$state boolean
return void

Property Details

$_template protected_oe property

Template
protected string $_template
return string

$_template_rows protected_oe property

Template rows
protected string $_template_rows
return string

$_test_items_visible protected_oe property

List of visible test items
protected array $_test_items_visible
return array

$active public_oe property

Active flag
public bool $active
return boolean

$results public_oe property

Test results
public array $results
return array

$strict public_oe property

Whether to use === or == when comparing
public bool $strict
return boolean