SwitchDbHashCommandTest
extends TestCase
in package
Uses
PathResolverTrait, WithConsecutiveTrait
SwitchDbHashCommand test.
Tags
Table of Contents
- $encryptionAlgorithm : string
- Encryption algorithm to use
- $expectedConfigIniPath : string
- Expected path to config.ini
- setUp() : void
- Standard setup method.
- testFailedConfigWrite() : void
- Test failed configuration write.
- testNoActionNeeded() : void
- Test no action needed because no changes requested.
- testSuccessNoUsers() : void
- Test success with no users to update.
- testSuccessWithCard() : void
- Test success with a card to update.
- testSuccessWithUser() : void
- Test success with a user to update.
- testWithoutKeyParameter() : void
- Test missing key parameter (not in config or on command line).
- testWithoutParameters() : void
- Test that missing parameters yield an error message.
- addPathResolverToContainer() : void
- Add PathResolverFactory to a mock container
- decode() : string
- Decode a hash to confirm that it was encoded correctly.
- expectConsecutiveCalls() : InvocationStubber
- Expect consecutive calls to a mock.
- getMockCardService() : MockObject|UserCardServiceInterface
- Get mock card table object
- getMockCommand() : MockObject|SwitchDbHashCommand
- Get mock command object
- getMockConfigWriter() : MockObject|Writer
- Get a mock config writer
- getMockUserCardEntity() : MockObject|UserCardEntityInterface
- Get a mock row representing a card.
- getMockUserObject() : MockObject|UserEntityInterface
- Get a mock row representing a user.
- getMockUserService() : MockObject|UserServiceInterface
- Get mock user database service object
- getPathResolver() : PathResolver
- Get a config file path resolver
Properties
$encryptionAlgorithm
Encryption algorithm to use
protected
string
$encryptionAlgorithm
= 'aes'
$expectedConfigIniPath
Expected path to config.ini
protected
string
$expectedConfigIniPath
Methods
setUp()
Standard setup method.
public
setUp() : void
Return values
void —testFailedConfigWrite()
Test failed configuration write.
public
testFailedConfigWrite() : void
Return values
void —testNoActionNeeded()
Test no action needed because no changes requested.
public
testNoActionNeeded() : void
Return values
void —testSuccessNoUsers()
Test success with no users to update.
public
testSuccessNoUsers() : void
Return values
void —testSuccessWithCard()
Test success with a card to update.
public
testSuccessWithCard() : void
Return values
void —testSuccessWithUser()
Test success with a user to update.
public
testSuccessWithUser() : void
Return values
void —testWithoutKeyParameter()
Test missing key parameter (not in config or on command line).
public
testWithoutKeyParameter() : void
Return values
void —testWithoutParameters()
Test that missing parameters yield an error message.
public
testWithoutParameters() : void
Return values
void —addPathResolverToContainer()
Add PathResolverFactory to a mock container
protected
addPathResolverToContainer(MockContainer $container) : void
Parameters
- $container : MockContainer
-
Mock Container
Return values
void —decode()
Decode a hash to confirm that it was encoded correctly.
protected
decode(string $hash) : string
Parameters
- $hash : string
-
Hash to decode
Return values
string —expectConsecutiveCalls()
Expect consecutive calls to a mock.
protected
expectConsecutiveCalls(MockObject $mock, string $method, array<string|int, mixed> $expectedCalls[, mixed $returnValues = null ]) : InvocationStubber
Parameters
- $mock : MockObject
-
Mock object
- $method : string
-
Method expecting calls
- $expectedCalls : array<string|int, mixed>
-
Expected input parameters
- $returnValues : mixed = null
-
Return values to mock (either an array indexed parallel to $expectedCalls to return different values, or a single value to always return the same thing)
Return values
InvocationStubber —getMockCardService()
Get mock card table object
protected
getMockCardService() : MockObject|UserCardServiceInterface
Return values
MockObject|UserCardServiceInterface —getMockCommand()
Get mock command object
protected
getMockCommand([array<string|int, mixed> $config = [] ][, UserServiceInterface|null $userService = null ][, UserCardServiceInterface|null $cardService = null ]) : MockObject|SwitchDbHashCommand
Parameters
- $config : array<string|int, mixed> = []
-
Config settings
- $userService : UserServiceInterface|null = null
-
User table gateway
- $cardService : UserCardServiceInterface|null = null
-
User table gateway
Return values
MockObject|SwitchDbHashCommand —getMockConfigWriter()
Get a mock config writer
protected
getMockConfigWriter() : MockObject|Writer
Return values
MockObject|Writer —getMockUserCardEntity()
Get a mock row representing a card.
protected
getMockUserCardEntity() : MockObject|UserCardEntityInterface
Return values
MockObject|UserCardEntityInterface —getMockUserObject()
Get a mock row representing a user.
protected
getMockUserObject() : MockObject|UserEntityInterface
Return values
MockObject|UserEntityInterface —getMockUserService()
Get mock user database service object
protected
getMockUserService() : MockObject|UserServiceInterface
Return values
MockObject|UserServiceInterface —getPathResolver()
Get a config file path resolver
protected
getPathResolver([string|null $baseDirectory = null ]) : PathResolver
Parameters
- $baseDirectory : string|null = null
-
Optional directory to override APPLICATION_PATH