File tree Expand file tree Collapse file tree 2 files changed +38
-3
lines changed Expand file tree Collapse file tree 2 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 11--TEST--
2- MongoDB\Driver\Session::startTransaction() with wrong argument for options array on PHP 7
2+ MongoDB\Driver\Session::startTransaction() with wrong argument for options array on PHP 7.0
33--SKIPIF--
44<?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
55<?php skip_if_not_libmongoc_crypto () ?>
66<?php skip_if_no_transactions (); ?>
77<?php skip_if_php_version ('< ' , '7.0.0 ' ); ?>
8+ <?php skip_if_php_version ('>= ' , '7.1.0 ' ); ?>
89--FILE--
910<?php
1011require_once __DIR__ . "/../utils/basic.inc " ;
@@ -28,7 +29,7 @@ foreach ($options as $txnOptions) {
2829<?php exit (0 ); ?>
2930--EXPECTF--
3031OK: Got TypeError
31- Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array or null , int%S given
32+ Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array, int%S given
3233OK: Got TypeError
33- Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array or null , object given
34+ Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array, object given
3435===DONE===
Original file line number Diff line number Diff line change 1+ --TEST--
2+ MongoDB\Driver\Session::startTransaction() with wrong argument for options array on PHP 7
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
5+ <?php skip_if_not_libmongoc_crypto () ?>
6+ <?php skip_if_no_transactions (); ?>
7+ <?php skip_if_php_version ('< ' , '7.1.0 ' ); ?>
8+ --FILE--
9+ <?php
10+ require_once __DIR__ . "/../utils/basic.inc " ;
11+
12+ $ manager = new MongoDB \Driver \Manager (URI );
13+ $ session = $ manager ->startSession ();
14+
15+ $ options = [
16+ 2 ,
17+ new stdClass ,
18+ ];
19+
20+ foreach ($ options as $ txnOptions ) {
21+ echo throws (function () use ($ session , $ txnOptions ) {
22+ $ session ->startTransaction ($ txnOptions );
23+ }, TypeError::class), "\n" ;
24+ }
25+
26+ ?>
27+ ===DONE===
28+ <?php exit (0 ); ?>
29+ --EXPECTF--
30+ OK: Got TypeError
31+ Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array or null, int%S given
32+ OK: Got TypeError
33+ Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array or null, object given
34+ ===DONE===
You can’t perform that action at this time.
0 commit comments