Skip to content

Commit 728e4d8

Browse files
committed
Test invalid types for more int32 and string URI options
1 parent 71098c5 commit 728e4d8

File tree

1 file changed

+93
-2
lines changed

1 file changed

+93
-2
lines changed

tests/manager/manager-ctor_error-003.phpt

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ $integerOptions = [
5454
'serverSelectionTimeoutMS',
5555
'socketCheckIntervalMS',
5656
'socketTimeoutMS',
57+
'srvMaxHosts',
58+
'zlibCompressionLevel',
5759
];
5860

5961
$invalidIntegerValues = [
@@ -69,7 +71,7 @@ foreach ($integerOptions as $option) {
6971
foreach ($invalidIntegerValues as $value) {
7072
echo throws(function() use ($option, $value) {
7173
create_test_manager(null, [$option => $value]);
72-
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
74+
}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
7375
}
7476
}
7577

@@ -79,9 +81,14 @@ $stringOptions = [
7981
'appname',
8082
'authMechanism',
8183
'authSource',
84+
'compressors',
8285
'gssapiServiceName',
8386
'password',
8487
'replicaSet',
88+
'srvServiceName',
89+
'tlsCAFile',
90+
'tlsCertificateKeyFile',
91+
'tlsCertificateKeyFilePassword',
8592
'username',
8693
];
8794

@@ -98,7 +105,7 @@ foreach ($stringOptions as $option) {
98105
foreach ($invalidStringValues as $value) {
99106
echo throws(function() use ($option, $value) {
100107
create_test_manager(null, [$option => $value]);
101-
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
108+
}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
102109
}
103110
}
104111

@@ -378,6 +385,30 @@ OK: Got MongoDB\Driver\Exception\InvalidArgumentException
378385
Expected 32-bit integer for "socketTimeoutMS" URI option, array given
379386
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
380387
Expected 32-bit integer for "socketTimeoutMS" URI option, document given
388+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
389+
Expected 32-bit integer for "srvMaxHosts" URI option, boolean given
390+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
391+
Expected 32-bit integer for "srvMaxHosts" URI option, double given
392+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
393+
Expected 32-bit integer for "srvMaxHosts" URI option, string given
394+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
395+
Expected 32-bit integer for "srvMaxHosts" URI option, ObjectId given
396+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
397+
Expected 32-bit integer for "srvMaxHosts" URI option, array given
398+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
399+
Expected 32-bit integer for "srvMaxHosts" URI option, document given
400+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
401+
Expected 32-bit integer for "zlibCompressionLevel" URI option, boolean given
402+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
403+
Expected 32-bit integer for "zlibCompressionLevel" URI option, double given
404+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
405+
Expected 32-bit integer for "zlibCompressionLevel" URI option, string given
406+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
407+
Expected 32-bit integer for "zlibCompressionLevel" URI option, ObjectId given
408+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
409+
Expected 32-bit integer for "zlibCompressionLevel" URI option, array given
410+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
411+
Expected 32-bit integer for "zlibCompressionLevel" URI option, document given
381412

382413
Testing string options:
383414
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
@@ -417,6 +448,18 @@ Expected string for "authSource" URI option, array given
417448
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
418449
Expected string for "authSource" URI option, document given
419450
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
451+
Expected string for "compressors" URI option, boolean given
452+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
453+
Expected string for "compressors" URI option, double given
454+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
455+
Expected string for "compressors" URI option, 32-bit integer given
456+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
457+
Expected string for "compressors" URI option, ObjectId given
458+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
459+
Expected string for "compressors" URI option, array given
460+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
461+
Expected string for "compressors" URI option, document given
462+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
420463
Expected string for "gssapiServiceName" URI option, boolean given
421464
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
422465
Expected string for "gssapiServiceName" URI option, double given
@@ -453,6 +496,54 @@ Expected string for "replicaSet" URI option, array given
453496
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
454497
Expected string for "replicaSet" URI option, document given
455498
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
499+
Expected string for "srvServiceName" URI option, boolean given
500+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
501+
Expected string for "srvServiceName" URI option, double given
502+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
503+
Expected string for "srvServiceName" URI option, 32-bit integer given
504+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
505+
Expected string for "srvServiceName" URI option, ObjectId given
506+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
507+
Expected string for "srvServiceName" URI option, array given
508+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
509+
Expected string for "srvServiceName" URI option, document given
510+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
511+
Expected string for "tlsCAFile" URI option, boolean given
512+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
513+
Expected string for "tlsCAFile" URI option, double given
514+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
515+
Expected string for "tlsCAFile" URI option, 32-bit integer given
516+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
517+
Expected string for "tlsCAFile" URI option, ObjectId given
518+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
519+
Expected string for "tlsCAFile" URI option, array given
520+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
521+
Expected string for "tlsCAFile" URI option, document given
522+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
523+
Expected string for "tlsCertificateKeyFile" URI option, boolean given
524+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
525+
Expected string for "tlsCertificateKeyFile" URI option, double given
526+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
527+
Expected string for "tlsCertificateKeyFile" URI option, 32-bit integer given
528+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
529+
Expected string for "tlsCertificateKeyFile" URI option, ObjectId given
530+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
531+
Expected string for "tlsCertificateKeyFile" URI option, array given
532+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
533+
Expected string for "tlsCertificateKeyFile" URI option, document given
534+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
535+
Expected string for "tlsCertificateKeyFilePassword" URI option, boolean given
536+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
537+
Expected string for "tlsCertificateKeyFilePassword" URI option, double given
538+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
539+
Expected string for "tlsCertificateKeyFilePassword" URI option, 32-bit integer given
540+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
541+
Expected string for "tlsCertificateKeyFilePassword" URI option, ObjectId given
542+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
543+
Expected string for "tlsCertificateKeyFilePassword" URI option, array given
544+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
545+
Expected string for "tlsCertificateKeyFilePassword" URI option, document given
546+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
456547
Expected string for "username" URI option, boolean given
457548
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
458549
Expected string for "username" URI option, double given

0 commit comments

Comments
 (0)