PHP Class malkusch\lock\mutex\MutexConcurrencyTest

If you want to run integration tests you should provide these environment variables: - MEMCACHE_HOST - REDIS_URIS - a comma separated list of redis:// URIs. - MYSQL_DSN, MYSQL_USER - PGSQL_DSN, PGSQL_USER
See also: Mutex
Author: Markus Malkusch ([email protected])
Inheritance: extends PHPUnit_Framework_TestCase
Show file Open project: malkusch/lock

Public Methods

Method Description
provideMutexFactories ( ) : callable[][] Provides Mutex factories.
provideTestHighContention ( ) : array Returns test cases for testHighContention().
testHighContention ( callable $code, callable $mutexFactory ) Tests high contention empirically.
testSerialisation ( callable $mutexFactory ) Tests that two processes run sequentially.

Private Methods

Method Description
fork ( integer $concurrency, callable $code ) Forks, runs code in the children and wait until all finished.
getPDO ( string $dsn, string $user ) : PDO Gets a PDO instance.

Method Details

provideMutexFactories() public method

Provides Mutex factories.
public provideMutexFactories ( ) : callable[][]
return callable[][] The mutex factories.

provideTestHighContention() public method

Returns test cases for testHighContention().
public provideTestHighContention ( ) : array
return array The test cases.

testHighContention() public method

Tests high contention empirically.
public testHighContention ( callable $code, callable $mutexFactory )
$code callable The counter code.
$mutexFactory callable The mutex factory.

testSerialisation() public method

Tests that two processes run sequentially.
public testSerialisation ( callable $mutexFactory )
$mutexFactory callable The Mutex factory.