PHP Класс 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.
Показать файл Открыть проект

Открытые методы

Метод Описание
__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.

Приватные методы

Метод Описание
filterLog ( String $line ) Filter out junk content from a log line.

Описание методов

__construct() публичный метод

public __construct ( )

checkLogForTestFailure() публичный метод

Checks if line contains failure regex
public checkLogForTestFailure ( string $line ) : boolean
$line string
Результат boolean

checkLogForTestPass() публичный метод

Check if it contains any text that indiciates that the test has passed.
public checkLogForTestPass ( string $line ) : boolean
$line string
Результат boolean

filterFileName() публичный метод

Filter out content from a title any to improve readability of the test name
public filterFileName ( string $filename ) : string
$filename string
Результат string

filterTitle() публичный метод

This is to improve readability of the test list.
public filterTitle ( string $title ) : string
$title string
Результат string

getFilename() публичный метод

Get the file Filename
public getFilename ( ) : string
Результат string

getHash() публичный метод

The hash is the Test title that's been md5'd.
public getHash ( ) : string
Результат string

getLog() публичный метод

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.
Результат HTML/Array

getState() публичный метод

Get the Test state based on if the test has run or passed.
public getState ( ) : boolean
Результат boolean

getTitle() публичный метод

Get the Test title
public getTitle ( ) : string
Результат string

getType() публичный метод

Get the Test type
public getType ( ) : string
Результат string

init() публичный метод

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

makeHash() публичный метод

Generate a unique hash for the test.
public makeHash ( string $string ) : string
$string string
Результат string MD5 of $string

passed() публичный метод

Return if the test was run and passed
public passed ( ) : boolean
Результат boolean

ran() публичный метод

This is deteremined by simply checking the length of the log.
public ran ( ) : boolean
Результат boolean

reset() публичный метод

Reset a Test back to default.
public reset ( )

setFailed() публичный метод

Sets passed to false if test fails
public setFailed ( )

setLog() публичный метод

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

setPassed() публичный метод

Set if the test has been passed.
public setPassed ( ) : boolean
Результат boolean