public function testGetData()
 {
     $expected = ['totalRecords' => null, 'items' => []];
     $this->collectionMock->expects($this->once())->method('addEntityFilter')->willReturnSelf();
     $this->collectionMock->expects($this->once())->method('addStoreData')->willReturnSelf();
     $this->requestMock->expects($this->once())->method('getParam')->with('current_product_id', 0)->willReturn(1);
     $this->assertSame($expected, $this->model->getData());
 }
Exemplo n.º 2
0
 public function testGetCollection()
 {
     $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue(new \Magento\Framework\DataObject(['id' => 42])));
     $this->currentCustomer->expects($this->any())->method('getCustomerId')->will($this->returnValue(4242));
     $this->collection->expects($this->any())->method('addStoreFilter')->with(42)->will($this->returnValue($this->collection));
     $this->collection->expects($this->any())->method('addCustomerFilter')->with(4242)->will($this->returnValue($this->collection));
     $this->collection->expects($this->any())->method('setDateOrder')->with()->will($this->returnValue($this->collection));
     $this->collection->expects($this->any())->method('setPageSize')->with(5)->will($this->returnValue($this->collection));
     $this->collection->expects($this->any())->method('load')->with()->will($this->returnValue($this->collection));
     $this->collection->expects($this->any())->method('addReviewSummary')->with()->will($this->returnValue($this->collection));
     $this->assertSame($this->collection, $this->object->getReviews());
 }