PHP Class RedUNIT\RedUNIT

Author: Gabor de Mooij
Show file Open project: gabordemooij/redbean

Protected Properties

Property Type Description
$currentlyActiveDriverID string
$round integer

Public Methods

Method Description
cleanUp ( ) : void Clean-up method, to be invoked after running the test.
getRound ( ) : integer Returns the current round number.
getTargetDrivers ( ) : array What drivers should be loaded for this test pack ? This method should be implemented by the test to tell the test controller system what drivers are supposed to be tested.
isFirstRound ( ) : boolean Detects whether the current round is the first one.
prepare ( ) Prepare test pack (mostly: nuke the entire database).
run ( ) : void Runs the test. This method will run the tests implemented by the RedUNIT instance. The run method scans its class for all public instance methods except: run (to avoid recursion), getTargetDrivers, onEvent and prepare. -- added cleanUp/prepare just in case they get overridden.
setCurrentDriver ( string $driver ) : void Sets the current driver.
setRound ( integer $roundNumber ) : void Sets the round number.

Method Details

cleanUp() public method

This is an empty implementation, it does nothing. However this method should be overridden by tests that require clean-up.
public cleanUp ( ) : void
return void

getRound() public method

The current round number indicates how many times this test has been applied (to various drivers).
public getRound ( ) : integer
return integer

getTargetDrivers() abstract public method

Each driver will be fed to the test in a 'round' (explained below).
abstract public getTargetDrivers ( ) : array
return array

isFirstRound() public method

If the current round is indeed the first round, this method will return boolean TRUE, otherwise it will return FALSE. Note that the rounds are 0-based, so - if the current round equals 0, this method will return TRUE.
public isFirstRound ( ) : boolean
return boolean

prepare() public method

This method prepares the test for a run.
public prepare ( )

run() public method

Runs the test. This method will run the tests implemented by the RedUNIT instance. The run method scans its class for all public instance methods except: run (to avoid recursion), getTargetDrivers, onEvent and prepare. -- added cleanUp/prepare just in case they get overridden.
public run ( ) : void
return void

setCurrentDriver() public method

This method is called by a test controller, runner or manager to activate the mode associated with the specified driver identifier. This mechanism allows a test to run slightly different in the context of another driver, for instance SQLite might not need some tests, or MySQL might need some additional tests etc...
public setCurrentDriver ( string $driver ) : void
$driver string the driver identifier
return void

setRound() public method

Each test can have a varying number of flavors. A test flavor is 'that same test' but for a different driver. Each 'run on a specific driver' is called a round. Some tests might want to know what the current round is. This method can be used to set the current round number.
public setRound ( integer $roundNumber ) : void
$roundNumber integer round, the current round number
return void

Property Details

$currentlyActiveDriverID protected property

protected string $currentlyActiveDriverID
return string

$round protected property

protected int $round
return integer