/** * @dataProvider elasticaResults */ public function testHybridTransformDecoratesResultsWithHybridResultObjects($result, $transformedObject) { $transformer = $this->getMock('FOS\\ElasticaBundle\\Transformer\\ElasticaToModelTransformerInterface'); $transformer->expects($this->any())->method('getIdentifierField')->will($this->returnValue('id')); $transformer->expects($this->any())->method('transform')->will($this->returnValue(array($transformedObject))); $collection = new ElasticaToModelTransformerCollection(array('type1' => $transformer)); $hybridResults = $collection->hybridTransform(array($result)); $this->assertInternalType('array', $hybridResults); $this->assertNotEmpty($hybridResults); $this->assertContainsOnlyInstancesOf('FOS\\ElasticaBundle\\HybridResult', $hybridResults); $hybridResult = array_pop($hybridResults); $this->assertEquals($result, $hybridResult->getResult()); $this->assertEquals($transformedObject, $hybridResult->getTransformed()); }