-
Notifications
You must be signed in to change notification settings - Fork 0
CI_Unit_test
Mathieu Nayrolles edited this page Jan 20, 2016
·
1 revision
Unit Testing Class
Simple testing class
- Class name: CI_Unit_test
- Namespace:
public boolean $active = TRUE
Active flag
- Visibility: public
public array $results = array()
Test results
- Visibility: public
public boolean $strict = FALSE
Strict comparison flag
Whether to use === or == when comparing
- Visibility: public
protected string $_template = NULL
Template
- Visibility: protected
protected string $_template_rows = NULL
Template rows
- Visibility: protected
protected array $_test_items_visible = array('test_name', 'test_datatype', 'res_datatype', 'result', 'file', 'line', 'notes')
List of visible test items
- Visibility: protected
void CI_Unit_test::__construct()
Constructor
- Visibility: public
void CI_Unit_test::set_test_items(array $items)
Run the tests
Runs the supplied tests
- Visibility: public
- $items array
string CI_Unit_test::run(mixed $test, mixed $expected, string $test_name, string $notes)
Run the tests
Runs the supplied tests
- Visibility: public
- $test mixed
- $expected mixed
- $test_name string
- $notes string
string CI_Unit_test::report(array $result)
Generate a report
Displays a table with the test data
- Visibility: public
- $result array
void CI_Unit_test::use_strict(boolean $state)
Use strict comparison
Causes the evaluation to use === rather than ==
- Visibility: public
- $state boolean
void CI_Unit_test::active($state)
Make Unit testing active
Enables/disables unit testing
- Visibility: public
- $state mixed
array CI_Unit_test::result(array $results)
Result Array
Returns the raw result data
- Visibility: public
- $results array
void CI_Unit_test::set_template($template)
Set the template
This lets us set the template to be used to display results
- Visibility: public
- $template mixed
array CI_Unit_test::_backtrace()
Generate a backtrace
This lets us show file names and line numbers
- Visibility: protected
string CI_Unit_test::_default_template()
Get Default Template
- Visibility: protected
void CI_Unit_test::_parse_template()
Parse Template
Harvests the data within the template {pseudo-variables}
- Visibility: protected