/**
  * @test
  * @dataProvider rangeConstraintExamples
  */
 public function rangeConstraintsWork($constraint, $operator, $value)
 {
     $this->queryBuilder->{$constraint}('fieldName', $value);
     $expected = array('range' => array('fieldName' => array($operator => $value)));
     $actual = $this->queryBuilder->getRequest();
     $this->assertInArray($expected, $actual['query']['filtered']['filter']['bool']['must']);
 }
 /**
  * @test
  */
 public function aCustomAggregationDefinitionCanBeApplied()
 {
     $expected = ["foo" => ["some" => ["field" => "bar"], "custom" => ["field" => "bar"], "arrays" => ["field" => "bar"]]];
     $this->queryBuilder->aggregation("foo", $expected['foo']);
     $actual = $this->queryBuilder->getRequest();
     $this->assertInArray($expected, $actual);
 }
 /**
  * @test
  */
 public function aggregationsCanAdded()
 {
     $aggregationTitle = "titleagg";
     $result = $this->queryBuilder->query($this->context->getRootNode())->fieldBasedAggregation($aggregationTitle, "title")->execute()->getAggregations();
     $this->assertArrayHasKey($aggregationTitle, $result);
     // assume three results because there are three nodes created with an title set
     $this->assertCount(3, $result[$aggregationTitle]);
 }
 /**
  * {@inheritdoc}
  */
 public function getOffset()
 {
     return $this->queryBuilder->getFrom();
 }
 /**
  * @param NodeInterface $node
  * @return \TYPO3\TYPO3CR\Search\Search\QueryBuilderInterface
  */
 public function query(NodeInterface $node)
 {
     return parent::query($node);
 }
 /**
  * @test
  */
 public function nodesWillBeSortedAsc()
 {
     $ascendingResult = $this->queryBuilder->query($this->context->getRootNode())->sortAsc("title")->execute();
     $node = $ascendingResult->getFirst();
     $this->assertEquals("chicken", $node->getProperty("title"), "Asserting a asc sort order by property title");
 }