Example #1
0
 public function testGetEntitySummary()
 {
     $productId = 6;
     $storeId = 4;
     $testSummaryData = ['test' => 'value'];
     $summary = new \Magento\Framework\Object();
     $summary->setData($testSummaryData);
     $product = $this->getMock('Magento\\Catalog\\Model\\Product', ['getId', 'setRatingSummary', '__wakeup'], [], '', false);
     $product->expects($this->once())->method('getId')->will($this->returnValue($productId));
     $product->expects($this->once())->method('setRatingSummary')->with($summary)->will($this->returnSelf());
     $summaryData = $this->getMock('Magento\\Review\\Model\\Review\\Summary', ['load', 'getData', 'setStoreId', '__wakeup'], [], '', false);
     $summaryData->expects($this->once())->method('setStoreId')->with($this->equalTo($storeId))->will($this->returnSelf());
     $summaryData->expects($this->once())->method('load')->with($this->equalTo($productId))->will($this->returnSelf());
     $summaryData->expects($this->once())->method('getData')->will($this->returnValue($testSummaryData));
     $this->summaryModMock->expects($this->once())->method('create')->will($this->returnValue($summaryData));
     $this->assertNull($this->review->getEntitySummary($product, $storeId));
 }