PHP Class Kraken\_Unit\Network\Http\Component\Router\HttpRouterTest

Inheritance: extends Kraken\Test\TUnit
Show file Open project: kraken-php/framework

Public Methods

Method Description
createComponent ( ) : Kraken\Network\NetworkComponentInterface | PHPUnit_Framework_MockObject_MockObject
createMatcher ( string[] | null $methods = [] ) : Symfony\Component\Routing\Matcher\UrlMatcher | PHPUnit_Framework_MockObject_MockObject
createRouter ( Kraken\Network\NetworkComponentAwareInterface $aware, string[] | null $methods = null, mixed[] $params = [] ) : HttpRouter | PHPUnit_Framework_MockObject_MockObject
createServer ( string[] | null $methods = [] ) : Kraken\Network\NetworkComponentAwareInterface | PHPUnit_Framework_MockObject_MockObject
testApiAddRoute_AddsRoute_WhenRouteDoesNotExist ( )
testApiAddRoute_ReplacesRoute_WhenRouteDoesExist ( )
testApiAllowOrigin_BlocksAddress ( )
testApiConstructor_CreatesInstance ( )
testApiDestructor_DoesNotThrowException ( )
testApiDisallowOrigin_UnblocksAddress ( )
testApiExistsRoute_ReturnsFalse_WhenRouteDoesNotExist ( )
testApiExistsRoute_ReturnsTrue_WhenRouteDoesExist ( )
testApiGetAllowedOrigins ( )
testApiHandleConnect_DoesNothing ( )
testApiHandleDisconnect_DoesNothing_WhenConnectionControllerDoesNotExist ( )
testApiHandleDisconnect_PropagatesDisconnection_WhenConnectionControllerDoesExist ( )
testApiHandleError_ClosesConnectionWithCode500_WhenConnectionControllerDoesExistButThrowsException ( )
testApiHandleError_ClosesConnectionWithCode500_WhenConnectionControllerDoesNotExist ( )
testApiHandleError_PropagatesErrorToController_WhenConnectionControllerDoesExist ( )
testApiHandleMessage_ClosesConnectionWithCode403_WhenHttpRequestReceived_ButMatcherThrowsMethodNotAllowedException ( )
testApiHandleMessage_ClosesConnectionWithCode403_WhenHttpRequestReceived_ButOriginIsNotAllowed ( )
testApiHandleMessage_ClosesConnectionWithCode404_WhenHttpRequestReceived_ButMatcherThrowsResourceNotFoundException ( )
testApiHandleMessage_ClosesConnectionWithCode500_WhenHttpRequestReceived_ButMatcherThrowsException ( )
testApiHandleMessage_ClosesConnectionWithCode500_WhenNotHttpRequestReceived_AndControllerDoesNotExist ( )
testApiHandleMessage_HandlesConnectAndHandlesMessage_WhenHttpRequestReceived ( )
testApiHandleMessage_HandlesError_WhenHttpRequestReceived_ButHandleConnectThrowsException ( )
testApiHandleMessage_PropagatesMessage_WhenNotHttpRequestReceived_AndControllerDoesExist ( )
testApiIsOriginAllowed_ReturnsFalse_WhenIpIsNotBlocked ( )
testApiIsOriginAllowed_ReturnsTrue_WhenIpIsBlocked ( )
testApiRemoveRoute_DoesNothing_WhenRouteDoesNotExist ( )
testApiRemoveRoute_RemovesRoute_WhenRouteDoesExist ( )
testProtectedApiClose_ClosesSocket ( )

Private Methods

Method Description
createPassableMessage ( ) : HttpRequest | PHPUnit_Framework_MockObject_MockObject

Method Details

createComponent() public method

public createComponent ( ) : Kraken\Network\NetworkComponentInterface | PHPUnit_Framework_MockObject_MockObject
return Kraken\Network\NetworkComponentInterface | PHPUnit_Framework_MockObject_MockObject

createMatcher() public method

public createMatcher ( string[] | null $methods = [] ) : Symfony\Component\Routing\Matcher\UrlMatcher | PHPUnit_Framework_MockObject_MockObject
$methods string[] | null
return Symfony\Component\Routing\Matcher\UrlMatcher | PHPUnit_Framework_MockObject_MockObject

createRouter() public method

public createRouter ( Kraken\Network\NetworkComponentAwareInterface $aware, string[] | null $methods = null, mixed[] $params = [] ) : HttpRouter | PHPUnit_Framework_MockObject_MockObject
$aware Kraken\Network\NetworkComponentAwareInterface
$methods string[] | null
$params mixed[]
return Kraken\Network\Http\Component\Router\HttpRouter | PHPUnit_Framework_MockObject_MockObject

createServer() public method

public createServer ( string[] | null $methods = [] ) : Kraken\Network\NetworkComponentAwareInterface | PHPUnit_Framework_MockObject_MockObject
$methods string[] | null
return Kraken\Network\NetworkComponentAwareInterface | PHPUnit_Framework_MockObject_MockObject

testApiAddRoute_AddsRoute_WhenRouteDoesNotExist() public method

testApiAddRoute_ReplacesRoute_WhenRouteDoesExist() public method

testApiAllowOrigin_BlocksAddress() public method

testApiConstructor_CreatesInstance() public method

testApiDestructor_DoesNotThrowException() public method

testApiDisallowOrigin_UnblocksAddress() public method

testApiExistsRoute_ReturnsFalse_WhenRouteDoesNotExist() public method

testApiExistsRoute_ReturnsTrue_WhenRouteDoesExist() public method

testApiGetAllowedOrigins() public method

testApiHandleConnect_DoesNothing() public method

testApiHandleDisconnect_DoesNothing_WhenConnectionControllerDoesNotExist() public method

testApiHandleDisconnect_PropagatesDisconnection_WhenConnectionControllerDoesExist() public method

testApiHandleError_ClosesConnectionWithCode500_WhenConnectionControllerDoesExistButThrowsException() public method

testApiHandleError_ClosesConnectionWithCode500_WhenConnectionControllerDoesNotExist() public method

testApiHandleError_PropagatesErrorToController_WhenConnectionControllerDoesExist() public method

testApiHandleMessage_ClosesConnectionWithCode403_WhenHttpRequestReceived_ButMatcherThrowsMethodNotAllowedException() public method

testApiHandleMessage_ClosesConnectionWithCode403_WhenHttpRequestReceived_ButOriginIsNotAllowed() public method

testApiHandleMessage_ClosesConnectionWithCode404_WhenHttpRequestReceived_ButMatcherThrowsResourceNotFoundException() public method

testApiHandleMessage_ClosesConnectionWithCode500_WhenHttpRequestReceived_ButMatcherThrowsException() public method

testApiHandleMessage_ClosesConnectionWithCode500_WhenNotHttpRequestReceived_AndControllerDoesNotExist() public method

testApiHandleMessage_HandlesConnectAndHandlesMessage_WhenHttpRequestReceived() public method

testApiHandleMessage_HandlesError_WhenHttpRequestReceived_ButHandleConnectThrowsException() public method

testApiHandleMessage_PropagatesMessage_WhenNotHttpRequestReceived_AndControllerDoesExist() public method

testApiIsOriginAllowed_ReturnsFalse_WhenIpIsNotBlocked() public method

testApiIsOriginAllowed_ReturnsTrue_WhenIpIsBlocked() public method

testApiRemoveRoute_DoesNothing_WhenRouteDoesNotExist() public method

testApiRemoveRoute_RemovesRoute_WhenRouteDoesExist() public method

testProtectedApiClose_ClosesSocket() public method