PHP Class App\Lib\Test

(c) James Healey For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
Afficher le fichier Open project: jayhealey/webception

Méthodes publiques

Méthode Description
__construct ( )
checkLogForTestFailure ( string $line ) : boolean Checks if line contains failure regex
checkLogForTestPass ( string $line ) : boolean Check if it contains any text that indiciates that the test has passed.
filterFileName ( string $filename ) : string Filter out content from a title any to improve readability of the test name
filterTitle ( string $title ) : string Turn a "CamelCasedString" into "Camel Cased String".
getFilename ( ) : string Get the file Filename
getHash ( ) : string Get the Test Hash
getLog ( $format = TRUE ) : HTML/Array Return the log as a HTML string.
getState ( ) : boolean Get the Test state based on if the test has run or passed.
getTitle ( ) : string Get the Test title
getType ( ) : string Get the Test type
init ( string $type, object $file ) Initialization of the Test
makeHash ( string $string ) : string Generate a unique hash for the test.
passed ( ) : boolean Return if the test was run and passed
ran ( ) : boolean Return if the test was successfully run.
reset ( ) Reset a Test back to default.
setFailed ( ) Sets passed to false if test fails
setLog ( $lines = [] ) Add a new line entry to the Test log.
setPassed ( ) : boolean Set if the test has been passed.

Private Methods

Méthode Description
filterLog ( String $line ) Filter out junk content from a log line.

Method Details

__construct() public méthode

public __construct ( )

checkLogForTestFailure() public méthode

Checks if line contains failure regex
public checkLogForTestFailure ( string $line ) : boolean
$line string
Résultat boolean

checkLogForTestPass() public méthode

Check if it contains any text that indiciates that the test has passed.
public checkLogForTestPass ( string $line ) : boolean
$line string
Résultat boolean

filterFileName() public méthode

Filter out content from a title any to improve readability of the test name
public filterFileName ( string $filename ) : string
$filename string
Résultat string

filterTitle() public méthode

This is to improve readability of the test list.
public filterTitle ( string $title ) : string
$title string
Résultat string

getFilename() public méthode

Get the file Filename
public getFilename ( ) : string
Résultat string

getHash() public méthode

The hash is the Test title that's been md5'd.
public getHash ( ) : string
Résultat string

getLog() public méthode

Return the log as a HTML string.
public getLog ( $format = TRUE ) : HTML/Array
$format Split the array into HTML with linebreaks or return as-is if false.
Résultat HTML/Array

getState() public méthode

Get the Test state based on if the test has run or passed.
public getState ( ) : boolean
Résultat boolean

getTitle() public méthode

Get the Test title
public getTitle ( ) : string
Résultat string

getType() public méthode

Get the Test type
public getType ( ) : string
Résultat string

init() public méthode

Initialization of the Test
public init ( string $type, object $file )
$type string Type of Test
$file object File for the Test

makeHash() public méthode

Generate a unique hash for the test.
public makeHash ( string $string ) : string
$string string
Résultat string MD5 of $string

passed() public méthode

Return if the test was run and passed
public passed ( ) : boolean
Résultat boolean

ran() public méthode

This is deteremined by simply checking the length of the log.
public ran ( ) : boolean
Résultat boolean

reset() public méthode

Reset a Test back to default.
public reset ( )

setFailed() public méthode

Sets passed to false if test fails
public setFailed ( )

setLog() public méthode

Also check the log line may indicate if the Test has passed.
public setLog ( $lines = [] )

setPassed() public méthode

Set if the test has been passed.
public setPassed ( ) : boolean
Résultat boolean