/** * @param bool $isSecure * @param string $actionUrl * @param int $productId * @dataProvider getActionDataProvider */ public function testGetAction($isSecure, $actionUrl, $productId) { $this->urlBuilder->expects($this->any())->method('getUrl')->with('review/product/post', ['_secure' => $isSecure, 'id' => $productId])->willReturn($actionUrl . '/id/' . $productId); $this->requestMock->expects($this->any())->method('getParam')->with('id', false)->willReturn($productId); $this->requestMock->expects($this->any())->method('isSecure')->willReturn($isSecure); $this->assertEquals($actionUrl . '/id/' . $productId, $this->object->getAction()); }
public function testGetProductInfo() { $productId = 3; $storeId = 1; $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue(new \Magento\Framework\Object(['id' => $storeId]))); $this->requestMock->expects($this->once())->method('getParam')->with('id', false)->willReturn($productId); $productMock = $this->getMock('Magento\\Catalog\\Api\\Data\\ProductInterface'); $this->productRepository->expects($this->once())->method('getById')->with($productId, false, $storeId)->willReturn($productMock); $this->assertSame($productMock, $this->object->getProductInfo()); }