9
9
use MongoDB \Driver \ReadPreference ;
10
10
use MongoDB \Driver \WriteConcern ;
11
11
use MongoDB \Exception \InvalidArgumentException ;
12
+ use MongoDB \Exception \UnsupportedException ;
12
13
use MongoDB \Operation \Count ;
13
14
use MongoDB \Operation \MapReduce ;
14
15
use MongoDB \Tests \CommandObserver ;
@@ -619,8 +620,6 @@ function(array $event) {
619
620
620
621
/**
621
622
* @dataProvider collectionWriteMethodClosures
622
- * @expectedException MongoDB\Exception\UnsupportedException
623
- * @expectedExceptionMessage "writeConcern" option cannot be specified within a transaction
624
623
*/
625
624
public function testMethodInTransactionWithWriteConcernOption ($ method )
626
625
{
@@ -631,6 +630,9 @@ public function testMethodInTransactionWithWriteConcernOption($method)
631
630
$ session = $ this ->manager ->startSession ();
632
631
$ session ->startTransaction ();
633
632
633
+ $ this ->expectException (UnsupportedException::class);
634
+ $ this ->expectExceptionMessage ('"writeConcern" option cannot be specified within a transaction ' );
635
+
634
636
try {
635
637
call_user_func ($ method , $ this ->collection , $ session , ['writeConcern ' => new WriteConcern (1 )]);
636
638
} finally {
@@ -640,8 +642,6 @@ public function testMethodInTransactionWithWriteConcernOption($method)
640
642
641
643
/**
642
644
* @dataProvider collectionReadMethodClosures
643
- * @expectedException MongoDB\Exception\UnsupportedException
644
- * @expectedExceptionMessage "readConcern" option cannot be specified within a transaction
645
645
*/
646
646
public function testMethodInTransactionWithReadConcernOption ($ method )
647
647
{
@@ -652,6 +652,9 @@ public function testMethodInTransactionWithReadConcernOption($method)
652
652
$ session = $ this ->manager ->startSession ();
653
653
$ session ->startTransaction ();
654
654
655
+ $ this ->expectException (UnsupportedException::class);
656
+ $ this ->expectExceptionMessage ('"readConcern" option cannot be specified within a transaction ' );
657
+
655
658
try {
656
659
call_user_func ($ method , $ this ->collection , $ session , ['readConcern ' => new ReadConcern (ReadConcern::LOCAL )]);
657
660
} finally {
0 commit comments