Skip to content

Commit a495bf5

Browse files
authored
PHPLIB-884: Remove manual preparation of "contention" option (#945)
The necessary fix is included in MongoDB 6.0.0-rc10.
1 parent 265810a commit a495bf5

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

tests/SpecTests/ClientSideEncryptionSpecTest.php

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function testClientSideEncryption(stdClass $test, ?array $runOn, array $d
124124

125125
// TODO: Remove this once SERVER-66901 is implemented (see: PHPLIB-884)
126126
if (isset($test->clientOptions->autoEncryptOpts->encryptedFieldsMap)) {
127-
$test->clientOptions->autoEncryptOpts->encryptedFieldsMap = $this->prepareEncryptedFieldsMap($test->clientOptions->autoEncryptOpts->encryptedFieldsMap);
127+
$test->clientOptions->autoEncryptOpts->encryptedFieldsMap = $test->clientOptions->autoEncryptOpts->encryptedFieldsMap;
128128
}
129129

130130
try {
@@ -1233,7 +1233,7 @@ public function testExplicitEncryption(Closure $test): void
12331233
}
12341234

12351235
// Test setup
1236-
$encryptedFields = $this->prepareEncryptedFields($this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/etc/data/encryptedFields.json')));
1236+
$encryptedFields = $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/etc/data/encryptedFields.json'));
12371237
$key1Document = $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/etc/data/keys/key1-document.json'));
12381238
$key1Id = $key1Document->_id;
12391239

@@ -1407,7 +1407,7 @@ private function createTestCollection(?stdClass $encryptedFields = null, ?stdCla
14071407
$options = $context->defaultWriteOptions;
14081408

14091409
if (! empty($encryptedFields)) {
1410-
$options['encryptedFields'] = $this->prepareEncryptedFields($encryptedFields);
1410+
$options['encryptedFields'] = $encryptedFields;
14111411
}
14121412

14131413
if (! empty($jsonSchema)) {
@@ -1530,34 +1530,6 @@ private function prepareCorpusData(string $fieldName, stdClass $data, ClientEncr
15301530
return $data->allowed ? $returnData : $data;
15311531
}
15321532

1533-
/**
1534-
* @todo Remove this once SERVER-66901 is implemented
1535-
* @see https://jira.mongodb.org/browse/PHPLIB-884
1536-
*/
1537-
private function prepareEncryptedFields(stdClass $encryptedFields): stdClass
1538-
{
1539-
foreach ($encryptedFields->fields as $field) {
1540-
if (isset($field->queries->contention)) {
1541-
$field->queries->contention = $this->createInt64($field->queries->contention);
1542-
}
1543-
}
1544-
1545-
return $encryptedFields;
1546-
}
1547-
1548-
/**
1549-
* @todo Remove this once SERVER-66901 is implemented
1550-
* @see https://jira.mongodb.org/browse/PHPLIB-884
1551-
*/
1552-
private function prepareEncryptedFieldsMap(stdClass $encryptedFieldsMap): stdClass
1553-
{
1554-
foreach ($encryptedFieldsMap as $namespace => $encryptedFields) {
1555-
$encryptedFieldsMap->{$namespace} = $this->prepareEncryptedFields($encryptedFields);
1556-
}
1557-
1558-
return $encryptedFieldsMap;
1559-
}
1560-
15611533
private static function isCryptSharedLibAvailable(): bool
15621534
{
15631535
$cryptSharedLibPath = getenv('CRYPT_SHARED_LIB_PATH');

0 commit comments

Comments
 (0)