Skip to content

Commit 33fb14f

Browse files
committed
PHPLIB-462: Fix PHPUnit warnings
1 parent bfbf5a7 commit 33fb14f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tests/Collection/CollectionFunctionalTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use MongoDB\Driver\ReadPreference;
1010
use MongoDB\Driver\WriteConcern;
1111
use MongoDB\Exception\InvalidArgumentException;
12+
use MongoDB\Exception\UnsupportedException;
1213
use MongoDB\Operation\Count;
1314
use MongoDB\Operation\MapReduce;
1415
use MongoDB\Tests\CommandObserver;
@@ -619,8 +620,6 @@ function(array $event) {
619620

620621
/**
621622
* @dataProvider collectionWriteMethodClosures
622-
* @expectedException MongoDB\Exception\UnsupportedException
623-
* @expectedExceptionMessage "writeConcern" option cannot be specified within a transaction
624623
*/
625624
public function testMethodInTransactionWithWriteConcernOption($method)
626625
{
@@ -631,6 +630,9 @@ public function testMethodInTransactionWithWriteConcernOption($method)
631630
$session = $this->manager->startSession();
632631
$session->startTransaction();
633632

633+
$this->expectException(UnsupportedException::class);
634+
$this->expectExceptionMessage('"writeConcern" option cannot be specified within a transaction');
635+
634636
try {
635637
call_user_func($method, $this->collection, $session, ['writeConcern' => new WriteConcern(1)]);
636638
} finally {
@@ -640,8 +642,6 @@ public function testMethodInTransactionWithWriteConcernOption($method)
640642

641643
/**
642644
* @dataProvider collectionReadMethodClosures
643-
* @expectedException MongoDB\Exception\UnsupportedException
644-
* @expectedExceptionMessage "readConcern" option cannot be specified within a transaction
645645
*/
646646
public function testMethodInTransactionWithReadConcernOption($method)
647647
{
@@ -652,6 +652,9 @@ public function testMethodInTransactionWithReadConcernOption($method)
652652
$session = $this->manager->startSession();
653653
$session->startTransaction();
654654

655+
$this->expectException(UnsupportedException::class);
656+
$this->expectExceptionMessage('"readConcern" option cannot be specified within a transaction');
657+
655658
try {
656659
call_user_func($method, $this->collection, $session, ['readConcern' => new ReadConcern(ReadConcern::LOCAL)]);
657660
} finally {

tests/SpecTests/ErrorExpectation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function assert(TestCase $test, Exception $actual = null)
132132
$test->assertNotNull($actual);
133133

134134
if (isset($this->messageContains)) {
135-
$test->assertContains($this->messageContains, $actual->getMessage(), '', true /* case-insensitive */);
135+
$test->assertStringContainsStringIgnoringCase($this->messageContains, $actual->getMessage());
136136
}
137137

138138
if (isset($this->codeName)) {
@@ -178,7 +178,7 @@ private function assertCodeName(TestCase $test, Exception $actual = null)
178178
$test->assertInstanceOf(CommandException::class, $actual);
179179
$result = $actual->getResultDocument();
180180
$test->assertObjectHasAttribute('codeName', $result);
181-
$test->assertAttributeSame($this->codeName, 'codeName', $result);
181+
$test->assertSame($this->codeName, $result->codeName);
182182
}
183183

184184
private static function isArrayOfStrings($array)

0 commit comments

Comments
 (0)