public function testFindBy()
 {
     $fields = array('title' => 'foo', 'text' => 'bar');
     $solr = $this->getMock('FS\\SolrBundle\\SolrFacade', array(), array(), '', false);
     $query = $this->getMock('FS\\SolrBundle\\Query\\SolrQuery', array(), array(), '', false);
     $query->expects($this->exactly(2))->method('addSearchTerm');
     $solr->expects($this->once())->method('createQuery')->will($this->returnValue($query));
     $solr->expects($this->once())->method('query')->with($query)->will($this->returnValue(array()));
     $entity = new ValidTestEntity();
     $repo = new Repository($solr, $entity);
     $found = $repo->findBy($fields);
     $this->assertTrue(is_array($found));
 }
 public function testFindBy()
 {
     $fields = array('title' => 'foo', 'text' => 'bar');
     $metaFactory = $this->getMock('FS\\SolrBundle\\Doctrine\\Mapper\\MetaInformationFactory', array(), array(), '', false);
     $metaFactory->expects($this->once())->method('loadInformation')->will($this->returnValue(MetaTestInformationFactory::getMetaInformation()));
     $solr = $this->getMock('FS\\SolrBundle\\Solr', array(), array(), '', false);
     $query = $this->getMock('FS\\SolrBundle\\Query\\SolrQuery', array(), array(), '', false);
     $query->expects($this->exactly(3))->method('addSearchTerm');
     $query->expects($this->once())->method('getHelper')->will($this->returnValue(new Helper()));
     $solr->expects($this->once())->method('createQuery')->will($this->returnValue($query));
     $solr->expects($this->once())->method('query')->with($query)->will($this->returnValue(array()));
     $solr->expects($this->once())->method('getMetaFactory')->will($this->returnValue($metaFactory));
     $entity = new ValidTestEntity();
     $repo = new Repository($solr, $entity);
     $found = $repo->findBy($fields);
     $this->assertTrue(is_array($found));
 }