diff --git a/tests/unit/extensions/mongodb/ActiveRecordTest.php b/tests/unit/extensions/mongodb/ActiveRecordTest.php index 177f5b17b2..ac0f12c529 100644 --- a/tests/unit/extensions/mongodb/ActiveRecordTest.php +++ b/tests/unit/extensions/mongodb/ActiveRecordTest.php @@ -274,6 +274,11 @@ class ActiveRecordTest extends MongoDbTestCase ->modify(['$set' => ['name' => $newName]], ['new' => true]); $this->assertTrue($customer instanceof Customer); $this->assertEquals($newName, $customer->name); + + $customer = Customer::find() + ->where(['name' => 'not existing name']) + ->modify(['$set' => ['name' => $newName]], ['new' => false]); + $this->assertNull($customer); } /** diff --git a/tests/unit/extensions/mongodb/QueryRunTest.php b/tests/unit/extensions/mongodb/QueryRunTest.php index 46dceaf428..0f7665df5e 100644 --- a/tests/unit/extensions/mongodb/QueryRunTest.php +++ b/tests/unit/extensions/mongodb/QueryRunTest.php @@ -230,6 +230,11 @@ class QueryRunTest extends MongoDbTestCase ->where(['name' => $searchName]) ->modify(['$set' => ['name' => $newName]], ['new' => true], $connection); $this->assertEquals($newName, $row['name']); + + $row = $query->from('customer') + ->where(['name' => 'not existing name']) + ->modify(['$set' => ['name' => 'new name']], ['new' => false], $connection); + $this->assertNull($row); } /**