mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-08 01:02:10 +02:00
The purpose is two-fold: abstract libmongo'c constant (defined as -3) from our users and ensure the string "majority" is sets the struct's "w" field properly even if our constant is not used.
41 lines
1021 B
PHP
41 lines
1021 B
PHP
--TEST--
|
|
MongoDB\WriteConcern construction
|
|
--SKIPIF--
|
|
<?php require "tests/utils/basic-skipif.inc"?>
|
|
--FILE--
|
|
<?php
|
|
require_once "tests/utils/basic.inc";
|
|
|
|
$mc = new MongoDB\Manager(MONGODB_URI);
|
|
|
|
|
|
$w = new MongoDB\WriteConcern(MongoDB\WriteConcern::MAJORITY);
|
|
$w2 = new MongoDB\WriteConcern(MongoDB\WriteConcern::MAJORITY, 1000);
|
|
|
|
$w3 = new MongoDB\WriteConcern(2);
|
|
$w4 = new MongoDB\WriteConcern(2, 2000);
|
|
|
|
$w5 = new MongoDB\WriteConcern("tagname");
|
|
$w6 = new MongoDB\WriteConcern("string", 3000);
|
|
|
|
$w7 = new MongoDB\WriteConcern("string", 3000, false, false);
|
|
$w8 = new MongoDB\WriteConcern("string", 3000, true, true);
|
|
|
|
$w9 = new MongoDB\WriteConcern("string", 3000, true, false);
|
|
$w10= new MongoDB\WriteConcern("string", 3000, false, true);
|
|
|
|
|
|
|
|
try {
|
|
new MongoDB\WriteConcern("string", 3000, false, true, 1);
|
|
} catch(InvalidArgumentException $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
MongoDB\WriteConcern::__construct() expects at most 4 parameters, 5 given
|
|
===DONE===
|