/**
  * @dataProvider createErrorsDataProvider
  *
  * @param array  $options
  * @param array  $expectedCalls
  * @param string $expectedException
  * @param string $expectedExceptionMessage
  */
 public function testCreateErrors(array $options, array $expectedCalls, $expectedException, $expectedExceptionMessage)
 {
     if (isset($options['converter']) && is_string($options['converter']) && method_exists($this, $options['converter'])) {
         $options['converter'] = $this->{$options}['converter']();
     }
     foreach ($expectedCalls as $key => $calls) {
         $mock = $this->{'getMock' . ucfirst($key)}();
         MockHelper::addMockExpectedCalls($mock, $calls, $this);
     }
     $this->setExpectedException($expectedException, $expectedExceptionMessage);
     $this->factory->create($this->type, null, $options);
 }
 /**
  * @dataProvider searchDataProvider
  * @param string $query
  * @param array $expectedResult
  * @param array $expectedIndexerCalls
  * @param array $expectSearchResultCalls
  * @param array $expectEntityRepositoryCalls
  * @param array $expectQueryBuilderCalls
  * @param array $expectExprCalls
  * @param array $expectQueryCalls
  * @param array $expectAclHelperCalls
  */
 public function testSearch($query, $expectedResult, $expectedIndexerCalls, $expectSearchResultCalls, $expectEntityRepositoryCalls, $expectQueryBuilderCalls, $expectExprCalls, $expectQueryCalls, $expectAclHelperCalls)
 {
     MockHelper::addMockExpectedCalls($this->indexer, $expectedIndexerCalls, $this);
     MockHelper::addMockExpectedCalls($this->searchResult, $expectSearchResultCalls, $this);
     MockHelper::addMockExpectedCalls($this->entityRepository, $expectEntityRepositoryCalls, $this);
     MockHelper::addMockExpectedCalls($this->queryBuilder, $expectQueryBuilderCalls, $this);
     MockHelper::addMockExpectedCalls($this->expr, $expectExprCalls, $this);
     MockHelper::addMockExpectedCalls($this->query, $expectQueryCalls, $this);
     MockHelper::addMockExpectedCalls($this->aclHelper, $expectAclHelperCalls, $this);
     $actualResult = $this->searchHandler->search($query['query'], $query['page'], $query['perPage']);
     $this->assertEquals($expectedResult, $actualResult);
 }