Context
in package
Execution context for spec tests.
This object tracks state that would be difficult to store on the test itself due to the design of PHPUnit's data providers and setUp/tearDown methods.
Table of Contents
- $activeClient : string
- $entityMap : EntityMap
- $eventCollectors : array<string|int, EventCollector>
- $eventObserversByClient : array<string|int, EventObserver>
- $inLoop : bool
- $internalClient : Client
- $uri : string
- __construct() : mixed
- assertExpectedEventsForClients() : void
- createEntities() : void
- Create entities for "createEntities".
- getEntityMap() : EntityMap
- getEventObserverForClient() : EventObserver
- getInternalClient() : Client
- isActiveClient() : bool
- isInLoop() : bool
- setActiveClient() : void
- setInLoop() : void
- startEventCollectors() : void
- startEventObservers() : void
- stopEventCollectors() : void
- stopEventObservers() : void
- convertReadPreferenceTags() : array<string|int, mixed>
- createBucket() : void
- createClient() : void
- createCollection() : void
- createDatabase() : void
- createEntityCollector() : void
- createSession() : void
- prepareBucketOptions() : array<string|int, mixed>
- prepareCollectionOrDatabaseOptions() : array<string|int, mixed>
- prepareDefaultTransactionOptions() : array<string|int, mixed>
- prepareSessionOptions() : array<string|int, mixed>
- removeMultipleMongoses() : string
- Removes mongos hosts beyond the first if the URI refers to a sharded cluster. Otherwise, the URI is returned as-is.
- requireMultipleMongoses() : void
- Requires multiple mongos hosts if the URI refers to a sharded cluster.
Properties
$activeClient
private
string
$activeClient
$entityMap
private
EntityMap
$entityMap
$eventCollectors
private
array<string|int, EventCollector>
$eventCollectors
= []
$eventObserversByClient
private
array<string|int, EventObserver>
$eventObserversByClient
= []
$inLoop
private
bool
$inLoop
= false
$internalClient
private
Client
$internalClient
$uri
private
string
$uri
Methods
__construct()
public
__construct(Client $internalClient, string $uri) : mixed
Parameters
- $internalClient : Client
- $uri : string
Return values
mixed —assertExpectedEventsForClients()
public
assertExpectedEventsForClients(array<string|int, mixed> $expectedEventsForClients) : void
Parameters
- $expectedEventsForClients : array<string|int, mixed>
Return values
void —createEntities()
Create entities for "createEntities".
public
createEntities(array<string|int, mixed> $entities) : void
Parameters
- $entities : array<string|int, mixed>
Return values
void —getEntityMap()
public
getEntityMap() : EntityMap
Return values
EntityMap —getEventObserverForClient()
public
getEventObserverForClient(string $id) : EventObserver
Parameters
- $id : string
Return values
EventObserver —getInternalClient()
public
getInternalClient() : Client
Return values
Client —isActiveClient()
public
isActiveClient(string $clientId) : bool
Parameters
- $clientId : string
Return values
bool —isInLoop()
public
isInLoop() : bool
Return values
bool —setActiveClient()
public
setActiveClient([string|null $clientId = null ]) : void
Parameters
- $clientId : string|null = null
Return values
void —setInLoop()
public
setInLoop(bool $inLoop) : void
Parameters
- $inLoop : bool
Return values
void —startEventCollectors()
public
startEventCollectors() : void
Return values
void —startEventObservers()
public
startEventObservers() : void
Return values
void —stopEventCollectors()
public
stopEventCollectors() : void
Return values
void —stopEventObservers()
public
stopEventObservers() : void
Return values
void —convertReadPreferenceTags()
private
convertReadPreferenceTags(string|array<string|int, mixed> $readPreferenceTags) : array<string|int, mixed>
Parameters
- $readPreferenceTags : string|array<string|int, mixed>
Return values
array<string|int, mixed> —createBucket()
private
createBucket(string $id, stdClass $o) : void
Parameters
- $id : string
- $o : stdClass
Return values
void —createClient()
private
createClient(string $id, stdClass $o) : void
Parameters
- $id : string
- $o : stdClass
Return values
void —createCollection()
private
createCollection(string $id, stdClass $o) : void
Parameters
- $id : string
- $o : stdClass
Return values
void —createDatabase()
private
createDatabase(string $id, stdClass $o) : void
Parameters
- $id : string
- $o : stdClass
Return values
void —createEntityCollector()
private
createEntityCollector(string $clientId, stdClass $o) : void
Parameters
- $clientId : string
- $o : stdClass
Return values
void —createSession()
private
createSession(string $id, stdClass $o) : void
Parameters
- $id : string
- $o : stdClass
Return values
void —prepareBucketOptions()
private
static prepareBucketOptions(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
Return values
array<string|int, mixed> —prepareCollectionOrDatabaseOptions()
private
static prepareCollectionOrDatabaseOptions(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
Return values
array<string|int, mixed> —prepareDefaultTransactionOptions()
private
static prepareDefaultTransactionOptions(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
Return values
array<string|int, mixed> —prepareSessionOptions()
private
static prepareSessionOptions(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
Return values
array<string|int, mixed> —removeMultipleMongoses()
Removes mongos hosts beyond the first if the URI refers to a sharded cluster. Otherwise, the URI is returned as-is.
private
static removeMultipleMongoses(string $uri) : string
Parameters
- $uri : string
Return values
string —requireMultipleMongoses()
Requires multiple mongos hosts if the URI refers to a sharded cluster.
private
static requireMultipleMongoses(string $uri) : void
Parameters
- $uri : string