コード例 #1
0
ファイル: ActiveRecordTest.php プロジェクト: aivavic/yii2
 public function testCallSnippets()
 {
     $query = 'pencil';
     $source = 'Some data sentence about ' . $query;
     $snippet = ArticleIndex::callSnippets($source, $query);
     $this->assertNotEmpty($snippet, 'Unable to call snippets!');
     $this->assertContains('<b>' . $query . '</b>', $snippet, 'Query not present in the snippet!');
     $rows = ArticleIndex::callSnippets([$source], $query);
     $this->assertNotEmpty($rows, 'Unable to call snippets!');
     $this->assertContains('<b>' . $query . '</b>', $rows[0], 'Query not present in the snippet!');
 }