Files
mongo-php-driver/tests/ocsp-failure.phpt
Andreas Braun a612c370f6 PHPC-1756: Remove oppressive terminology from source code (#1221)
* Use latest version of libmongoc

* Remove deprecated terminology for primary

* Remove deprecated terminology for secondary

* Fix clang-format

* Remove check for legacy field

* Fix missing space in error expectation

* Harden test expectation around primary checks
2021-06-22 19:30:56 +02:00

34 lines
1.0 KiB
PHP

--TEST--
Connection with OCSP checks fails
--SKIPIF--
<?php
if (getenv('TESTS') !== 'tests/ocsp-failure.phpt') { echo "skip OCSP tests not wanted\n"; }
?>
--FILE--
<?php
require_once __DIR__ . "/utils/basic.inc";
$ping = new \MongoDB\Driver\Command(['ping' => 1]);
// Expect command to fail with the provided options
$m = create_test_manager();
echo throws (function () use ($m, $ping) {
$m->executeCommand('admin', $ping);
}, "MongoDB\Driver\Exception\ConnectionTimeoutException"), "\n";
// Always expect command to pass when using insecure option
$m = create_test_manager(URI, ['tlsInsecure' => true]);
$m->executeCommand('admin', $ping);
// Always expect command to pass when allowing invalid certificates
$m = create_test_manager(URI, ['tlsAllowInvalidCertificates' => true]);
$m->executeCommand('admin', $ping);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
No suitable servers found (`serverSelectionTryOnce` set): [%s calling %s on '%s:%d']
===DONE===