|  |  |  | @ -6,6 +6,7 @@ use yiiunit\data\sphinx\ar\ActiveRecord; | 
			
		
	
		
			
				
					|  |  |  |  | use yiiunit\data\ar\ActiveRecord as ActiveRecordDb; | 
			
		
	
		
			
				
					|  |  |  |  | use yiiunit\data\sphinx\ar\ArticleIndex; | 
			
		
	
		
			
				
					|  |  |  |  | use yiiunit\data\sphinx\ar\ArticleDb; | 
			
		
	
		
			
				
					|  |  |  |  | use yiiunit\data\sphinx\ar\TagDb; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  |  * @group sphinx | 
			
		
	
	
		
			
				
					|  |  |  | @ -25,21 +26,37 @@ class ExternalActiveRelationTest extends SphinxTestCase | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		/** @var ArticleIndex $article */ | 
			
		
	
		
			
				
					|  |  |  |  | 		$article = ArticleIndex::find(['id' => 2]); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		// has one : | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertFalse($article->isRelationPopulated('source')); | 
			
		
	
		
			
				
					|  |  |  |  | 		$source = $article->source; | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($article->isRelationPopulated('source')); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($source instanceof ArticleDb); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertEquals(1, count($article->populatedRelations)); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		// has many : | 
			
		
	
		
			
				
					|  |  |  |  | 		/*$this->assertFalse($article->isRelationPopulated('tags')); | 
			
		
	
		
			
				
					|  |  |  |  | 		$tags = $article->tags; | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($article->isRelationPopulated('tags')); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertEquals(3, count($tags)); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($tags[0] instanceof TagDb);*/ | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	public function testFindEager() | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		// has one : | 
			
		
	
		
			
				
					|  |  |  |  | 		$articles = ArticleIndex::find()->with('source')->all(); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertEquals(2, count($articles)); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($articles[0]->isRelationPopulated('source')); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($articles[1]->isRelationPopulated('source')); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($articles[0]->source instanceof ArticleDb); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($articles[1]->source instanceof ArticleDb); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		// has many : | 
			
		
	
		
			
				
					|  |  |  |  | 		/*$articles = ArticleIndex::find()->with('tags')->all(); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertEquals(2, count($articles)); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($articles[0]->isRelationPopulated('tags')); | 
			
		
	
		
			
				
					|  |  |  |  | 		$this->assertTrue($articles[1]->isRelationPopulated('tags'));*/ | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
	
		
			
				
					|  |  |  | 
 |