コード例 #1
0
 public function testCreate()
 {
     $rawResponse = ['documents' => [['title' => 'oneTitle', 'description' => 'oneDescription'], ['title' => 'twoTitle', 'description' => 'twoDescription']], 'aggregations' => []];
     $this->documentFactory->expects($this->at(0))->method('create')->with($this->equalTo($rawResponse['documents'][0]))->will($this->returnValue('document1'));
     $this->documentFactory->expects($this->at(1))->method('create')->with($rawResponse['documents'][1])->will($this->returnValue('document2'));
     $this->objectManager->expects($this->once())->method('create')->with($this->equalTo('Magento\\Framework\\Search\\Response\\QueryResponse'), $this->equalTo(['documents' => ['document1', 'document2'], 'aggregations' => null]))->will($this->returnValue('QueryResponseObject'));
     $result = $this->factory->create($rawResponse);
     $this->assertEquals('QueryResponseObject', $result);
 }