lithium\tests\cases\data\source\MongoDbTest::testPreserveId PHP Method

testPreserveId() public method

Tests that the MongoDB adapter will not attempt to overwrite the _id field on document update.
public testPreserveId ( )
    public function testPreserveId()
    {
        $document = MockMongoPost::create(array('_id' => 'custom'), array('exists' => true));
        array_push($this->_db->connection->results, true);
        $this->assertTrue($document->save(array('_id' => 'custom2', 'foo' => 'bar')));
        $result = array_shift($this->_db->connection->queries);
        $expected = array('$set' => array('foo' => 'bar'));
        $this->assertEqual($expected, $result['update']);
    }