mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-03-26 01:42:10 +01:00
* Test on PHP 8.2 * Fix tests relating to dynamic properties * Fix tests failing due to different __set_state output * Duplicate clone test without dynamic properties for PHP >= 8.2
35 lines
761 B
PHP
35 lines
761 B
PHP
--TEST--
|
|
MongoDB\BSON\DBPointer can be cloned (PHP >= 8.2)
|
|
--SKIPIF--
|
|
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
|
|
<?php skip_if_php_version('<', '8.2'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once __DIR__ . '/../utils/basic.inc';
|
|
|
|
$test = MongoDB\BSON\toPHP(MongoDB\BSON\fromJSON('{ "dbref": {"$dbPointer": {"$ref": "phongo.test", "$id" : { "$oid" : "5a2e78accd485d55b405ac12" } }} }'));
|
|
|
|
$dbPointer = $test->dbref;
|
|
$clone = clone($dbPointer);
|
|
|
|
var_dump($clone == $dbPointer);
|
|
var_dump($clone === $dbPointer);
|
|
|
|
unset($dbPointer);
|
|
|
|
var_dump($clone);
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
bool(true)
|
|
bool(false)
|
|
object(MongoDB\BSON\DBPointer)#%d (2) {
|
|
["ref"]=>
|
|
string(11) "phongo.test"
|
|
["id"]=>
|
|
string(24) "5a2e78accd485d55b405ac12"
|
|
}
|
|
===DONE===
|