--TEST-- MongoDB\Driver\Monitoring\TopologyClosedEvent --SKIPIF-- --FILE-- getTopologyId() instanceof MongoDB\BSON\ObjectId) ? 'yes' : 'no'); var_dump($event); } public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } /* Note: TopologyClosedEvent can only be observed for non-persistent clients. * Persistent clients are destroyed in GSHUTDOWN, long after any PHP objects * (including subscribers) are freed. */ $m = create_test_manager(URI, [], ['disableClientPersistence' => true]); $m->addSubscriber(new MySubscriber); $command = new MongoDB\Driver\Command(['ping' => 1]); $m->executeCommand(DATABASE_NAME, $command); /* Events dispatched during mongoc_client_destroy can only be observed before * RSHUTDOWN. This means that we must use a non-persistent client and free it * before the script ends. */ unset($m); ?> ===DONE=== --EXPECTF-- getTopologyId() returns an ObjectId: yes object(MongoDB\Driver\Monitoring\TopologyClosedEvent)#%d (%d) { ["topologyId"]=> object(MongoDB\BSON\ObjectId)#%d (%d) { ["oid"]=> string(24) "%x" } } ===DONE===