Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Can not use fixture in test case. #16

Closed
bitshine opened this issue Jan 11, 2011 · 1 comment
Closed

Can not use fixture in test case. #16

bitshine opened this issue Jan 11, 2011 · 1 comment

Comments

@bitshine
Copy link

Everything is ok in using YiiMongoDbSuite, but when use fixture in the test, it show an error:

CDbConnection.connectionString cannot be empty.

@bitshine
Copy link
Author

I build a class MongoDbFixtureManager extends CDbFixtureManager.

require_once('d:/www/yii-1.1.5.r2654/framework/test/CDbFixtureManager.php');
    class MongoDbFixtureManager extends CDbFixtureManager
    {
    private $_db;

    public $connectionID='mongodb';

    public function getDbConnection()
    {
        if($this->_db===null)
        {           
            $this->_db=Yii::app()->getComponent($this->connectionID);           
            if(!$this->_db instanceof EMongoDB)
                throw new CException(Yii::t('yii','CDbTestFixture.connectionID "{id}" is invalid. Please make sure it refers to the ID of a CDbConnection application component.',
                    array('{id}'=>$this->connectionID)));
        }       
        return $this->_db;
    }
}

because mongodb has no schema, this can not work.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant