PHPLIB-462: Fix PHPUnit warnings

parent bfbf5a76
......@@ -9,6 +9,7 @@ use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
use MongoDB\Operation\Count;
use MongoDB\Operation\MapReduce;
use MongoDB\Tests\CommandObserver;
......@@ -619,8 +620,6 @@ class CollectionFunctionalTest extends FunctionalTestCase
/**
* @dataProvider collectionWriteMethodClosures
* @expectedException MongoDB\Exception\UnsupportedException
* @expectedExceptionMessage "writeConcern" option cannot be specified within a transaction
*/
public function testMethodInTransactionWithWriteConcernOption($method)
{
......@@ -631,6 +630,9 @@ class CollectionFunctionalTest extends FunctionalTestCase
$session = $this->manager->startSession();
$session->startTransaction();
$this->expectException(UnsupportedException::class);
$this->expectExceptionMessage('"writeConcern" option cannot be specified within a transaction');
try {
call_user_func($method, $this->collection, $session, ['writeConcern' => new WriteConcern(1)]);
} finally {
......@@ -640,8 +642,6 @@ class CollectionFunctionalTest extends FunctionalTestCase
/**
* @dataProvider collectionReadMethodClosures
* @expectedException MongoDB\Exception\UnsupportedException
* @expectedExceptionMessage "readConcern" option cannot be specified within a transaction
*/
public function testMethodInTransactionWithReadConcernOption($method)
{
......@@ -652,6 +652,9 @@ class CollectionFunctionalTest extends FunctionalTestCase
$session = $this->manager->startSession();
$session->startTransaction();
$this->expectException(UnsupportedException::class);
$this->expectExceptionMessage('"readConcern" option cannot be specified within a transaction');
try {
call_user_func($method, $this->collection, $session, ['readConcern' => new ReadConcern(ReadConcern::LOCAL)]);
} finally {
......
......@@ -132,7 +132,7 @@ final class ErrorExpectation
$test->assertNotNull($actual);
if (isset($this->messageContains)) {
$test->assertContains($this->messageContains, $actual->getMessage(), '', true /* case-insensitive */);
$test->assertStringContainsStringIgnoringCase($this->messageContains, $actual->getMessage());
}
if (isset($this->codeName)) {
......@@ -178,7 +178,7 @@ final class ErrorExpectation
$test->assertInstanceOf(CommandException::class, $actual);
$result = $actual->getResultDocument();
$test->assertObjectHasAttribute('codeName', $result);
$test->assertAttributeSame($this->codeName, 'codeName', $result);
$test->assertSame($this->codeName, $result->codeName);
}
private static function isArrayOfStrings($array)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment