PHP 클래스 lithium\test\Report

While Lithium already comes with a text-based as well as web-based test interface, you may use or extend the Report class to create your own test reporter functionality. In addition, you can also create your own custom templates for displaying results in a different format, such as json. Example usage, for built-in HTML format/reporter: {{{ $report = new Report(array( 'title' => 'Test Report Title', 'group' => new Group(array('data' => array('\lithium\tests\cases\net\http\MediaTest'))), 'format' => 'html', 'reporter' => 'html' )); $report->run(); Get the test stats: $report->stats(); Get test results: $report->results }}} You may also choose to filter the results of the test runs to obtain additional information. For example, say you wish to calculate the cyclomatic complexity of the classes you are testing: {{{ $report = new Report(array( 'title' => 'Test Report Title', 'group' => new Group(array('data' => array('\lithium\tests\cases\net\http\MediaTest'))), 'filters' => array('Complexity') )); $report->run(); Get test results, including filter results: $report->results }}}
또한 보기: lithium\test\Group
또한 보기: lithium\test\filter
또한 보기: lithium\test\templates
상속: extends lithium\core\Object
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$group object Contains an instance of lithium\test\Group, which contains all unit tests to be executed this test run.
$results array Group and filter results.
$timer array Start and end timers.
$title string Title of the group being run.

보호된 프로퍼티들

프로퍼티 타입 설명
$_filters array An array key on fully-namespaced class names of the filter with options to be applied for the filter as the value

공개 메소드들

메소드 설명
__construct ( array $config = [] ) : void Constructor.
collect ( string $class, array $results ) : void Collects Results from the test filters and aggregates them.
filters ( array $filters = [] )
render ( string $template, string | array $data = [] ) : string Renders the test output (e.g. layouts and filter templates).
run ( ) : void Runs tests.
stats ( ) : array Return statistics from the test runs.

보호된 메소드들

메소드 설명
_init ( ) : void Initializer.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( array $config = [] ) : void
$config array Options array for the test run. Valid options are: - `'group'`: The test group with items to be run. - `'filters'`: An array of filters that the test output should be run through. - `'format'`: The format of the template to use, defaults to `'txt'`. - `'reporter'`: The reporter to use.
리턴 void

_init() 보호된 메소드

Initializer.
protected _init ( ) : void
리턴 void

collect() 공개 메소드

Collects Results from the test filters and aggregates them.
public collect ( string $class, array $results ) : void
$class string Classname of the filter for which to aggregate results.
$results array Array of the filter results for later analysis by the filter itself.
리턴 void

filters() 공개 메소드

public filters ( array $filters = [] )
$filters array

render() 공개 메소드

Renders the test output (e.g. layouts and filter templates).
public render ( string $template, string | array $data = [] ) : string
$template string name of the template (i.e. `'layout'`).
$data string | array array from `_data()` method.
리턴 string

run() 공개 메소드

Runs tests.
public run ( ) : void
리턴 void

stats() 공개 메소드

Return statistics from the test runs.
public stats ( ) : array
리턴 array

프로퍼티 상세

$_filters 보호되어 있는 프로퍼티

An array key on fully-namespaced class names of the filter with options to be applied for the filter as the value
protected array $_filters
리턴 array

$group 공개적으로 프로퍼티

Contains an instance of lithium\test\Group, which contains all unit tests to be executed this test run.
또한 보기: lithium\test\Group
public object $group
리턴 object

$results 공개적으로 프로퍼티

Group and filter results.
public array $results
리턴 array

$timer 공개적으로 프로퍼티

Start and end timers.
public array $timer
리턴 array

$title 공개적으로 프로퍼티

Title of the group being run.
public string $title
리턴 string