PHP Class malkusch\lock\mutex\RedisMutexTest

See also: RedisMutex
Author: Markus Malkusch ([email protected])
Inheritance: extends PHPUnit_Framework_TestCase, use trait phpmock\phpunit\PHPMock
Mostra file Open project: malkusch/lock

Public Methods

Method Description
provideMajority ( ) : int[][] Provides test cases with enough.
provideMinority ( ) : int[][] Provides test cases with too few.
provideTestTimingOut ( ) : array Returns test cases for testTimingOut().
testAcquireTooFewKeys ( integer $count, integer $available ) Tests too few keys could be acquired.
testAcquireWithMajority ( integer $count, integer $available ) Tests synchronized() works if the majority of keys was acquired.
testFaultTolerance ( integer $count, integer $available ) Tests synchronized() does work if the majority of servers is up.
testReleaseTooFewKeys ( integer $count, integer $available ) Tests releasing too few keys.
testSeedRandom ( ) Tests seeding produces different tokens for each process.
testTimingOut ( integer $count, integer $timeout, integer $delay ) Tests acquiring keys takes too long.
testTooFewServerToAcquire ( integer $count, integer $available ) Tests acquire() fails because too few servers are available.
testTooFewServersToRelease ( integer $count, integer $available ) Tests releasing fails because too few servers are available.

Protected Methods

Method Description
setUp ( )

Private Methods

Method Description
buildRedisMutex ( integer $count, integer $timeout = 1 ) : PHPUnit_Framework_MockObject_MockObject Builds a testaböe RedisMutex mock.

Method Details

provideMajority() public method

Provides test cases with enough.
public provideMajority ( ) : int[][]
return int[][] Test cases.

provideMinority() public method

Provides test cases with too few.
public provideMinority ( ) : int[][]
return int[][] Test cases.

provideTestTimingOut() public method

Returns test cases for testTimingOut().
public provideTestTimingOut ( ) : array
return array Test cases.

setUp() protected method

protected setUp ( )

testAcquireTooFewKeys() public method

Tests too few keys could be acquired.
public testAcquireTooFewKeys ( integer $count, integer $available )
$count integer The total count of servers
$available integer The count of available servers.

testAcquireWithMajority() public method

Tests synchronized() works if the majority of keys was acquired.
public testAcquireWithMajority ( integer $count, integer $available )
$count integer The total count of servers
$available integer The count of available servers.

testFaultTolerance() public method

Tests synchronized() does work if the majority of servers is up.
public testFaultTolerance ( integer $count, integer $available )
$count integer The total count of servers
$available integer The count of available servers.

testReleaseTooFewKeys() public method

Tests releasing too few keys.
public testReleaseTooFewKeys ( integer $count, integer $available )
$count integer The total count of servers
$available integer The count of available servers.

testSeedRandom() public method

Tests seeding produces different tokens for each process.
public testSeedRandom ( )

testTimingOut() public method

Tests acquiring keys takes too long.
public testTimingOut ( integer $count, integer $timeout, integer $delay )
$count integer The total count of servers.
$timeout integer The timeout in seconds.
$delay integer The delay in microseconds.

testTooFewServerToAcquire() public method

Tests acquire() fails because too few servers are available.
public testTooFewServerToAcquire ( integer $count, integer $available )
$count integer The total count of servers
$available integer The count of available servers.

testTooFewServersToRelease() public method

Tests releasing fails because too few servers are available.
public testTooFewServersToRelease ( integer $count, integer $available )
$count integer The total count of servers
$available integer The count of available servers.