/** * @group unit */ public function testSetStopWords() { $query = new MoreLikeThis(); $stopWords = array('no', 'yes', 'test'); $query->setStopWords($stopWords); $this->assertEquals($stopWords, $query->getParam('stop_words')); }
/** * @group unit */ public function testToArrayForSource() { $query = new MoreLikeThis(); $query->setLike(new Document('', array('Foo' => 'Bar'), 'type', 'index')); $data = $query->toArray(); $this->assertEquals(array('more_like_this' => array('like' => array('_type' => 'type', '_index' => 'index', 'doc' => array('Foo' => 'Bar')))), $data); }
/** * @group unit */ public function testToArray() { $query = new MoreLikeThis(); $query->setLike(new Document(1, array(), 'type', 'index')); $data = $query->toArray(); $this->assertEquals(array('more_like_this' => array('like' => array('_id' => 1, '_type' => 'type', '_index' => 'index'))), $data); }