PHP Class Namshi\AB\Container

Inheritance: implements ArrayAcces\ArrayAccess, implements Countabl\Countable, implements IteratorAggregat\IteratorAggregate
Datei anzeigen Open project: namshi/ab Class Usage Examples

Protected Properties

Property Type Description
$seed
$tests

Public Methods

Method Description
__construct ( array $tests = [], integer $seed = null ) Constructor
add ( Test $test ) Adds a new $test.
count ( ) : integer Returns how many tests have been registered in this container.
createTest ( string $name, array $variations = [], array $parameters = [] ) : Test Creates, registers and returns a test with the given parameters.
disableTests ( ) Convenient method to disable all the tests registered with this container at once.
get ( string $test ) : Test Returns a test with the name $test.
getAll ( ) : array Returns all the tests registered in the container.
getIterator ( ) : ArrayIterator Returns the iterator to use to iterate over the container.
getSeed ( ) : integer Get the seed to be passed to each test.
offsetExists ( string $offset ) : boolean Checks whether a test is registered.
offsetGet ( string $offset ) : Test | null Returns a test, or null if the test was not found.
offsetSet ( string $offset, Test $value ) Registers a test.
offsetUnset ( string $offset ) Unregisters a test.
runTests ( ) Convenient method to run all the tests registered with this container at once.
setSeed ( integer $seed ) Sets the seed to be passed to each test.

Protected Methods

Method Description
calculateTestSeed ( integer $globalSeed, Test $test ) : integer Calculates a seed for the given $test, mixing the global seed and a numerical representation of the test name.

Method Details

__construct() public method

Constructor
public __construct ( array $tests = [], integer $seed = null )
$tests array
$seed integer

add() public method

Adds a new $test.
public add ( Test $test )
$test Test

calculateTestSeed() protected method

Calculates a seed for the given $test, mixing the global seed and a numerical representation of the test name.
protected calculateTestSeed ( integer $globalSeed, Test $test ) : integer
$globalSeed integer
$test Test
return integer

count() public method

Returns how many tests have been registered in this container.
public count ( ) : integer
return integer

createTest() public method

Creates, registers and returns a test with the given parameters.
public createTest ( string $name, array $variations = [], array $parameters = [] ) : Test
$name string
$variations array
$parameters array
return Test

disableTests() public method

Convenient method to disable all the tests registered with this container at once.
public disableTests ( )

get() public method

Returns a test with the name $test.
public get ( string $test ) : Test
$test string
return Test

getAll() public method

Returns all the tests registered in the container.
public getAll ( ) : array
return array

getIterator() public method

Returns the iterator to use to iterate over the container.

getSeed() public method

Get the seed to be passed to each test.
public getSeed ( ) : integer
return integer

offsetExists() public method

Checks whether a test is registered.
public offsetExists ( string $offset ) : boolean
$offset string
return boolean

offsetGet() public method

Returns a test, or null if the test was not found.
public offsetGet ( string $offset ) : Test | null
$offset string
return Test | null

offsetSet() public method

Registers a test.
public offsetSet ( string $offset, Test $value )
$offset string
$value Test

offsetUnset() public method

Unregisters a test.
public offsetUnset ( string $offset )
$offset string

runTests() public method

Convenient method to run all the tests registered with this container at once.
public runTests ( )

setSeed() public method

Sets the seed to be passed to each test.
public setSeed ( integer $seed )
$seed integer

Property Details

$seed protected_oe property

protected $seed

$tests protected_oe property

protected $tests