Files
mongo-php-driver/tests/manager/manager-ctor-disableClientPersistence-001.phpt
Jeremy Mikola 5e2f7b5461 PHPC-1645: Allow disabling of libmongoc client persistence (#1187)
* Replace client pointers on object structs with Manager references

* Request-scoped Manager registry for APM events

* Ensure Manager is registered regardless of persistent client

* Reset request-scoped clients when forking

* Test for freeing Manager during RSHUTDOWN via subscriber reference

Co-authored-by: Andreas Braun <git@alcaeus.org>
2021-01-12 08:27:32 -05:00

42 lines
1.6 KiB
PHP

--TEST--
MongoDB\Driver\Manager::__construct(): disableClientPersistence option
--FILE--
<?php
ini_set('mongodb.debug', 'stderr');
new MongoDB\Driver\Manager();
// Won't reuse first client due to different options
new MongoDB\Driver\Manager(null, [], ['disableClientPersistence' => false]);
// Will reuse the previous client due to same options
new MongoDB\Driver\Manager(null, [], ['disableClientPersistence' => false]);
// Will create a non-persistent client
new MongoDB\Driver\Manager(null, [], ['disableClientPersistence' => true]);
// Will create another non-persistent client
new MongoDB\Driver\Manager(null, [], ['disableClientPersistence' => true]);
ini_set('mongodb.debug', '');
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
%A
[%s] PHONGO: DEBUG > Created client with hash: %s
[%s] PHONGO: DEBUG > Stored persistent client with hash: %s
[%s] PHONGO: DEBUG > Not destroying persistent client for Manager%A
[%s] PHONGO: DEBUG > Created client with hash: %s
[%s] PHONGO: DEBUG > Stored persistent client with hash: %s
[%s] PHONGO: DEBUG > Not destroying persistent client for Manager%A
[%s] PHONGO: DEBUG > Found client for hash: %s
[%s] PHONGO: DEBUG > Not destroying persistent client for Manager%A
[%s] PHONGO: DEBUG > Created client with hash: %s
[%s] PHONGO: DEBUG > Stored non-persistent client
[%s] PHONGO: DEBUG > Destroying non-persistent client for Manager%A
[%s] PHONGO: DEBUG > Created client with hash: %s
[%s] PHONGO: DEBUG > Stored non-persistent client
[%s] PHONGO: DEBUG > Destroying non-persistent client for Manager%A
===DONE===