PHP Class Tests\Odesk\Phystrix\CommandTest

Inheritance: extends PHPUnit_Framework_TestCase
Show file Open project: odesk/phystrix

Protected Properties

Property Type Description
$circuitBreaker PHPUnit_Framework_MockObject_MockObject
$circuitBreakerFactory PHPUnit_Framework_MockObject_MockObject
$command Tests\Odesk\Phystrix\CommandMock
$commandMetrics PHPUnit_Framework_MockObject_MockObject
$commandMetricsFactory PHPUnit_Framework_MockObject_MockObject
$requestLog Odesk\Phystrix\RequestLog

Public Methods

Method Description
configBoolProvider ( ) : array
testBadRequestExceptionTracksNoMetrics ( )
testExecute ( )
testExecuteDefaultCommandKey ( )
testExecuteFallbackDisabled ( )
testExecuteFallbackFailed ( )
testExecutePresetCommandKey ( )
testExecuteRequestNotAllowed ( )
testExecuteRunException ( )
testRequestCacheDisabled ( )
testRequestCacheGetCacheKeyNotImplemented ( )
testRequestCacheHit ( )
testRequestCacheMiss ( ) Test case for cache miss scenario
testRequestCacheNotInjected ( boolean $cacheEnabled ) Ensure command does not break when configured to cache, though cache hasn't been injected
testRequestLogNotInjected ( boolean $logEnabled ) Ensure command does not break when configured to log, though one hasn't been injected
testRequestLogOff ( )
testRuntimeExceptionPopulated ( )
testSavesResultToCache ( )
testSetTestMergesConfig ( )
testShortCircuitedExceptionMessage ( )

Protected Methods

Method Description
setUp ( )
setUpCommonExpectations ( boolean $allowRequest = true ) Something many tests need
setUpExecutionDelayExpectations ( ) Makes the command run for 555 milliseconds

Method Details

configBoolProvider() public method

public configBoolProvider ( ) : array
return array

setUp() protected method

protected setUp ( )

setUpCommonExpectations() protected method

Something many tests need
protected setUpCommonExpectations ( boolean $allowRequest = true )
$allowRequest boolean (Optional) Whether CB should allow the request

setUpExecutionDelayExpectations() protected method

Makes the command run for 555 milliseconds

testBadRequestExceptionTracksNoMetrics() public method

testExecute() public method

public testExecute ( )

testExecuteDefaultCommandKey() public method

testExecuteFallbackDisabled() public method

testExecuteFallbackFailed() public method

testExecutePresetCommandKey() public method

testExecuteRequestNotAllowed() public method

testExecuteRunException() public method

testRequestCacheDisabled() public method

testRequestCacheGetCacheKeyNotImplemented() public method

testRequestCacheHit() public method

public testRequestCacheHit ( )

testRequestCacheMiss() public method

Test case for cache miss scenario

testRequestCacheNotInjected() public method

Ensure command does not break when configured to cache, though cache hasn't been injected
public testRequestCacheNotInjected ( boolean $cacheEnabled )
$cacheEnabled boolean whether config is set to use request log

testRequestLogNotInjected() public method

Ensure command does not break when configured to log, though one hasn't been injected
public testRequestLogNotInjected ( boolean $logEnabled )
$logEnabled boolean whether config is set to use request log

testRequestLogOff() public method

public testRequestLogOff ( )

testRuntimeExceptionPopulated() public method

testSavesResultToCache() public method

testSetTestMergesConfig() public method

testShortCircuitedExceptionMessage() public method

Property Details

$circuitBreaker protected property

protected PHPUnit_Framework_MockObject_MockObject $circuitBreaker
return PHPUnit_Framework_MockObject_MockObject

$circuitBreakerFactory protected property

protected PHPUnit_Framework_MockObject_MockObject $circuitBreakerFactory
return PHPUnit_Framework_MockObject_MockObject

$command protected property

protected CommandMock,Tests\Odesk\Phystrix $command
return Tests\Odesk\Phystrix\CommandMock

$commandMetrics protected property

protected PHPUnit_Framework_MockObject_MockObject $commandMetrics
return PHPUnit_Framework_MockObject_MockObject

$commandMetricsFactory protected property

protected PHPUnit_Framework_MockObject_MockObject $commandMetricsFactory
return PHPUnit_Framework_MockObject_MockObject

$requestLog protected property

protected RequestLog,Odesk\Phystrix $requestLog
return Odesk\Phystrix\RequestLog