Many_Many Relation Problem In Cdbtestcase

YII version 1.1.13

Hello i have a problem accessing MANY_MANY model relations in my CDbTestCase class method.

Here is the code

tests/fixtures/movies.php




return array(

      'editedMovie'=>array(

	 'title'=>'Lorem ipsum',

	 'description'=>'Lorem ipsum dolor sit amet',

      ), 

);



tests/fixtures/movies_tags.php




return array(

		'tag1'=>array('name'=>'tag1','popularity'=>'5688','active'=>'yes'),

		'tag2'=>array('name'=>'tag2','popularity'=>'1819','active'=>'yes'),

  );



tests/fixtures/movies_movies_tags.php




return array(

		'1'=>array('movieId'=>$this->getRecord('movies', 'editedMovie')->id, 'tagId'=>$this->getRecord('movies_tags', 'tag1')->id),

		'2'=>array('movieId'=>$this->getRecord('movies', 'editedMovie')->id, 'tagId'=>$this->getRecord('movies_tags', 'tag2')->id),

);



models/Movies.php




...

public function relations()

	{

		return array(

			'tags'=>array(self::MANY_MANY, 'MoviesTags', 'movies_movies_tags(movieId, tagId)'),

		);

	}

..



tests/unit/UserTest.php




class UsersTest extends CDbTestCase{

	

	public $fixtures=array(

		'movies_tags'=>'MoviesTags',

		'movies'=>'Movies',

		'movies_movies_tags'=>'MoviesMoviesTags',

	);

       

        ////////////////////////

        // BELOW IS THE PROBLEM

        ////////////////////////


	public function testAction(){

                $editedMovie=$this->movies('editedMovie');

		echo count($editedMovie->tags);         // prints 0 - incorrect output, expected 2

		$editedMovie=Movies::model()->findByPk($editedMovie->id);

		echo count($editedMovie->tags);         // prints 2, correct output

		exit;                

        }

}



as you see in UsersTest::testAction if we load an instance of Movies using CDbTestCase we can not access it’s MANY_MANY relation, but right after that we load the needed model using CActiveRecord findByPk method, and this way all the relation exists. What i’m doing wrong or is it a Yii bug?

Thanks

no solution? Is it a bug?