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

testGridFsDeleteWithCustomPrefix() public method

    public function testGridFsDeleteWithCustomPrefix()
    {
        $data = array('_id' => new MongoId());
        $db = new MongoDb($this->_testConfig + array('gridPrefix' => 'custom'));
        $db->server = new MockMongoConnection();
        $db->connection = new MockMongoConnection();
        Connections::add('temp', array('object' => $db));
        MockMongoPost::config(array('meta' => array('source' => 'fs.files', 'connection' => 'temp')));
        MockMongoPost::create($data, array('exists' => true))->delete();
        $this->assertIdentical(null, $db->connection->gridFsPrefix);
        MockMongoPost::config(array('meta' => array('source' => 'custom.files')));
        MockMongoPost::create($data, array('exists' => true))->delete();
        $this->assertIdentical('custom', $db->connection->gridFsPrefix);
        Connections::remove('temp');
    }