/** * Tests assignArrayToObject(). */ public function testAssignArrayToObject() { $stub = $this->getMockBuilder('\\ONGR\\ElasticsearchBundle\\Tests\\app\\fixture\\Acme\\TestBundle\\Document\\Item')->getMock(); $documentHighlight = new DocumentHighlight([]); $stub->expects($this->once())->method('setHighlight')->with($this->identicalTo($documentHighlight)); $stub->expects($this->once())->method('__set')->with($this->equalTo('foo'), $this->equalTo('bar')); $stub->expects($this->once())->method('setPrice')->with($this->equalTo(123)); $converter = new Converter([], []); $converter->assignArrayToObject(['foo' => 'bar', 'price' => (double) 123, 'highlight' => $documentHighlight], $stub, ['price' => ['propertyName' => 'price', 'type' => 'float'], 'highlight' => ['propertyName' => 'highlight', 'type' => 'DocumentHighlight']]); }
/** * {@inheritdoc} */ protected function convertDocument(array $document) { return $this->converter->assignArrayToObject($document, new $this->alias['namespace'](), $this->alias['aliases']); }