File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ MongoDB\Driver\Session spec test: snapshot option is incompatible with writes
3
+ --DESCRIPTION--
4
+ PHPC-1875: Disable writes on snapshot sessions
5
+ --SKIPIF--
6
+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
7
+ <?php skip_if_not_libmongoc_crypto (); ?>
8
+ <?php skip_if_not_live (); ?>
9
+ <?php skip_if_server_version ('< ' , '5.0 ' ); ?>
10
+ --FILE--
11
+ <?php
12
+ require_once __DIR__ . "/../utils/basic.inc " ;
13
+
14
+ $ manager = create_test_manager ();
15
+ $ session = $ manager ->startSession (['snapshot ' => true ]);
16
+
17
+ $ bulk = new MongoDB \Driver \BulkWrite ();
18
+ $ bulk ->insert (['x ' => 1 ]);
19
+
20
+ try {
21
+ $ manager ->executeBulkWrite (NS , $ bulk , ['session ' => $ session ]);
22
+ } catch (MongoDB \Driver \Exception \BulkWriteException $ e ) {
23
+ /* Note: we intentionally do not assert the server's error message for the
24
+ * client specifying a read concern on a write command. It is sufficient to
25
+ * assert that the error code is InvalidOptions(72). */
26
+ var_dump ($ e ->getCode () === 72 );
27
+ }
28
+
29
+ ?>
30
+ ===DONE===
31
+ <?php exit (0 ); ?>
32
+ --EXPECT--
33
+ bool(true)
34
+ ===DONE===
You can’t perform that action at this time.
0 commit comments