/** * {@inheritdoc} */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch'); if (!$pluginInfo) { return parent::dispatch($request); } else { return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo); } }
/** * Check postAction method and assert that review model storeId equals null. */ public function testPostAction() { $this->requestMock->expects($this->any()) ->method('getParam') ->willReturnMap( [ ['product_id', false, 1], ['ratings', [], ['1' => '1']] ] ); $this->requestMock->expects($this->once()) ->method('getPostValue') ->willReturn(['status_id' => 1]); $this->objectManagerMock->expects($this->any()) ->method('get') ->with('Magento\Store\Model\StoreManagerInterface') ->willReturn($this->storeManagerMock); $this->reviewFactoryMock->expects($this->once()) ->method('create') ->willReturn($this->reviewMock); $this->ratingFactoryMock->expects($this->once()) ->method('create') ->willReturn($this->ratingMock); $this->storeManagerMock->expects($this->once()) ->method('hasSingleStore') ->willReturn(true); $this->storeManagerMock->expects($this->once()) ->method('getStore') ->willReturn($this->storeModelMock); $this->storeModelMock->expects($this->once()) ->method('getId') ->willReturn(1); $this->reviewMock->expects($this->once()) ->method('save') ->willReturn($this->reviewMock); $this->reviewMock->expects($this->once()) ->method('getId') ->willReturn(1); $this->reviewMock->expects($this->once()) ->method('aggregate') ->willReturn($this->reviewMock); $this->ratingMock->expects($this->once()) ->method('setRatingId') ->willReturnSelf(); $this->ratingMock->expects($this->once()) ->method('setReviewId') ->willReturnSelf(); $this->ratingMock->expects($this->once()) ->method('addOptionVote') ->willReturnSelf(); $this->assertSame($this->resultRedirectMock, $this->postController->executeInternal()); }