Skip to content

Commit f207cdb

Browse files
committed
Append CRYPT_SHARED_LIB_PATH to autoEncryptionOpts in tests
1 parent 3029042 commit f207cdb

File tree

4 files changed

+7
-26
lines changed

4 files changed

+7
-26
lines changed

tests/FunctionalTestCase.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static function createTestClient(?string $uri = null, array $options = []
8585
return new Client(
8686
$uri ?? static::getUri(),
8787
static::appendAuthenticationOptions($options),
88-
static::appendServerApiOption($driverOptions),
88+
static::appendDriverOptions($driverOptions),
8989
);
9090
}
9191

@@ -94,7 +94,7 @@ public static function createTestManager(?string $uri = null, array $options = [
9494
return new Manager(
9595
$uri ?? static::getUri(),
9696
static::appendAuthenticationOptions($options),
97-
static::appendServerApiOption($driverOptions),
97+
static::appendDriverOptions($driverOptions),
9898
);
9999
}
100100

@@ -603,8 +603,12 @@ private static function appendAuthenticationOptions(array $options): array
603603
return $options;
604604
}
605605

606-
private static function appendServerApiOption(array $driverOptions): array
606+
private static function appendDriverOptions(array $driverOptions): array
607607
{
608+
if (isset($driverOptions['autoEncryption']) && getenv('CRYPT_SHARED_LIB_PATH')) {
609+
$driverOptions['autoEncryption']['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH');
610+
}
611+
608612
if (getenv('API_VERSION') && ! isset($driverOptions['serverApi'])) {
609613
$driverOptions['serverApi'] = new ServerApi(getenv('API_VERSION'));
610614
}

tests/SpecTests/ClientSideEncryption/FunctionalTestCase.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ public function setUp(): void
2727
$this->skipIfClientSideEncryptionIsNotSupported();
2828
}
2929

30-
public static function createTestClient(?string $uri = null, array $options = [], array $driverOptions = []): Client
31-
{
32-
if (isset($driverOptions['autoEncryption']) && getenv('CRYPT_SHARED_LIB_PATH')) {
33-
$driverOptions['autoEncryption']['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH');
34-
}
35-
36-
return parent::createTestClient($uri, $options, $driverOptions);
37-
}
38-
3930
protected static function getAWSCredentials(): array
4031
{
4132
return [

tests/SpecTests/ClientSideEncryptionSpecTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,6 @@ public static function assertCommandMatches(stdClass $expected, stdClass $actual
143143
static::assertDocumentsMatch($expected, $actual);
144144
}
145145

146-
public static function createTestClient(?string $uri = null, array $options = [], array $driverOptions = []): Client
147-
{
148-
if (isset($driverOptions['autoEncryption']) && getenv('CRYPT_SHARED_LIB_PATH')) {
149-
$driverOptions['autoEncryption']['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH');
150-
}
151-
152-
return parent::createTestClient($uri, $options, $driverOptions);
153-
}
154-
155146
/**
156147
* Execute an individual test case from the specification.
157148
*

tests/SpecTests/Context.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ public static function fromClientSideEncryption(stdClass $test, $databaseName, $
105105

106106
$autoEncryptionOptions['tlsOptions']->kmip = self::getKmsTlsOptions();
107107
}
108-
109-
// Intentionally ignore empty values for CRYPT_SHARED_LIB_PATH
110-
if (getenv('CRYPT_SHARED_LIB_PATH')) {
111-
$autoEncryptionOptions['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH');
112-
}
113108
}
114109

115110
if (isset($test->outcome->collection->name)) {

0 commit comments

Comments
 (0)