--TEST-- MongoDB\Driver\ClientEncryption::createDataKey() masterKey option invalid type --SKIPIF-- --FILE-- createClientEncryption([ 'keyVaultNamespace' => CSFLE_KEY_VAULT_NS, 'kmsProviders' => ['local' => ['key' => new MongoDB\BSON\Binary(CSFLE_LOCAL_KEY, 0)]], ]); echo throws(function () use ($clientEncryption) { $clientEncryption->createDataKey('local', ['masterKey' => 'not-array-or-object']); }, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n"; echo throws(function () use ($clientEncryption) { $clientEncryption->createDataKey('local', ['masterKey' => MongoDB\BSON\PackedArray::fromPHP([])]); }, MongoDB\Driver\Exception\UnexpectedValueException::class), "\n"; ?> ===DONE=== --EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "masterKey" option to be array or object, string given OK: Got MongoDB\Driver\Exception\UnexpectedValueException MongoDB\BSON\PackedArray cannot be serialized as a root document ===DONE===