PHP Class unittest\Output

Inheritance: use trait XPSPL\Singleton
Show file Open project: prggmr/xpspl Class Usage Examples

Public Properties

Property Type Description
$colors Color codes

Protected Properties

Property Type Description
$_breakcount Line break count
$_maxdepth Max recursion depth.

Public Methods

Method Description
assertion ( $test, string $assertion, array | null $args, null | boolean $result ) : void Outputs an assertion result.
backtrace ( array $backtrace, $type = self::ERROR ) : void Outputs a readable backtrace, by default it just dumps it from a for.
get_assertion_call_line ( ) : array Returns the location an assertion was called.
send ( string $string, string $type = null, boolean $newline = true ) : void Sends a string to output.
send_linebreak ( $type = null ) : void Sends a line break to the output with a border.
unknown_assertion ( $signal, string $func, array $args, object $assertion ) : void Generates an error indicating an unknown assertion has been called.
use_short_vars ( string $str = null ) : boolean Returns if short vars are enabled or to use.
variable ( mixed $v, integer &$depth ) : string Generates PHP vars like printr, var_dump the output is limited by using shortvars and the maximum output length.

Method Details

assertion() public method

Outputs an assertion result.
public assertion ( $test, string $assertion, array | null $args, null | boolean $result ) : void
$assertion string Name of the assertion
$args array | null Array of arguments used during test
$result null | boolean True-pass,False-fail,null-skipped
return void

backtrace() public method

The output generator is at fault for providing it simplified.
public backtrace ( array $backtrace, $type = self::ERROR ) : void
$backtrace array debug_print_backtrace()
return void

get_assertion_call_line() public method

Currently this just returns the node at index 3 a more advanced method for determaining the assertion call will need to be developed to account for changes in the flow.
public get_assertion_call_line ( ) : array
return array

send() public static method

Sends a string to output.
public static send ( string $string, string $type = null, boolean $newline = true ) : void
$string string Message to output
$type string Type of message for color generation if used.
$newline boolean Output line after string.
return void

send_linebreak() public method

Sends a line break to the output with a border.
public send_linebreak ( $type = null ) : void
return void

unknown_assertion() public method

Generates an error indicating an unknown assertion has been called.
public unknown_assertion ( $signal, string $func, array $args, object $assertion ) : void
$func string Assertion function called
$args array Array of arguments passed to the assertion
$assertion object The assertion object used
return void

use_short_vars() public method

Returns if short vars are enabled or to use.
public use_short_vars ( string $str = null ) : boolean
$str string
return boolean

variable() public method

Recursion is not checked for.
public variable ( mixed $v, integer &$depth ) : string
$v mixed
$depth integer Current transvering depth.
return string

Property Details

$_breakcount protected property

Line break count
protected $_breakcount

$_maxdepth protected property

Max recursion depth.
protected $_maxdepth

$colors public static property

Color codes
public static $colors