Commit 6fbd710d by Klimov Paul

Extra unit test for `yii\mongodb\Query::modify()` added

parent 29c3c248
......@@ -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);
}
/**
......
......@@ -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);
}
/**
......
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