Alcaeus\MongoDbAdapter\Tests\Mongo\MongoCollectionTest::testUpdateOne PHP Method

testUpdateOne() public method

public testUpdateOne ( )
    public function testUpdateOne()
    {
        $document = ['foo' => 'bar'];
        $this->getCollection()->insert($document);
        // Unset ID to re-insert
        unset($document['_id']);
        $this->getCollection()->insert($document);
        $expected = ['ok' => 1.0, 'nModified' => 1, 'n' => 1, 'err' => null, 'errmsg' => null, 'updatedExisting' => true];
        $result = $this->getCollection()->update(['foo' => 'bar'], ['$set' => ['foo' => 'foo']]);
        $this->assertSame($expected, $result);
        $this->assertSame(1, $this->getCheckDatabase()->selectCollection('test')->count(['foo' => 'foo']));
    }
MongoCollectionTest