Skip to content

Commit cf04535

Browse files
committed
Note ClientEncryption's parent client to ensure events are observed
1 parent 2871e7e commit cf04535

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/UnifiedSpecTests/Context.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ private function createClientEncryption(string $id, stdClass $o): void
333333
]);
334334

335335
$clientEncryptionOpts = [];
336+
$clientId = null;
336337

337338
if (isset($o->clientEncryptionOpts)) {
338339
assertIsObject($o->clientEncryptionOpts);
@@ -341,7 +342,10 @@ private function createClientEncryption(string $id, stdClass $o): void
341342

342343
if (isset($clientEncryptionOpts['keyVaultClient'])) {
343344
assertIsString($clientEncryptionOpts['keyVaultClient']);
344-
$clientEncryptionOpts['keyVaultClient'] = $this->entityMap->getClient($clientEncryptionOpts['keyVaultClient'])->getManager();
345+
/* Record the keyVaultClient's ID, which we'll later use to track
346+
* the parent client in the entity map. */
347+
$clientId = $clientEncryptionOpts['keyVaultClient'];
348+
$clientEncryptionOpts['keyVaultClient'] = $this->entityMap->getClient($clientId)->getManager();
345349
}
346350

347351
if (isset($clientEncryptionOpts['kmsProviders'])) {
@@ -384,7 +388,7 @@ private function createClientEncryption(string $id, stdClass $o): void
384388
}
385389
}
386390

387-
$this->entityMap->set($id, new ClientEncryption($clientEncryptionOpts));
391+
$this->entityMap->set($id, new ClientEncryption($clientEncryptionOpts), $clientId);
388392
}
389393

390394
private function createEntityCollector(string $clientId, stdClass $o): void

0 commit comments

Comments
 (0)