コード例 #1
0
 /**
  * @group functional
  */
 public function testSetType()
 {
     $index = $this->prepareSearchData();
     $filter = new HasChild(new MatchAll(), 'type_name');
     $this->assertEquals('type_name', $filter->getParam('type'));
     $filter->setType('new_type_name');
     $this->assertEquals('new_type_name', $filter->getParam('type'));
     $type = $index->getType('foo');
     $filter = new HasChild(new MatchAll(), $type);
     $this->assertEquals('foo', $filter->getParam('type'));
     $type = $index->getType('bar');
     $filter->setType($type);
     $this->assertEquals('bar', $filter->getParam('type'));
     $returnValue = $filter->setType('last');
     $this->assertInstanceOf('Elastica\\Filter\\HasChild', $returnValue);
 }