/** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Framework\View\LayoutFactory $layoutFactory */ public function __construct( Context $context, Registry $coreRegistry, ReviewFactory $reviewFactory, RatingFactory $ratingFactory, LayoutFactory $layoutFactory ) { $this->layoutFactory = $layoutFactory; parent::__construct($context, $coreRegistry, $reviewFactory, $ratingFactory); }
/** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ public function __construct( Context $context, Registry $coreRegistry, ReviewFactory $reviewFactory, RatingFactory $ratingFactory, ProductRepositoryInterface $productRepository ) { $this->productRepository = $productRepository; parent::__construct($context, $coreRegistry, $reviewFactory, $ratingFactory); }
/** * Check postAction method and assert that review model storeId equals null. */ public function testPostAction() { $this->_requestMock->expects($this->at(0))->method('getParam')->will($this->returnValue(1)); $this->_requestMock->expects($this->at(2))->method('getParam')->will($this->returnValue(array('1' => '1'))); $this->_requestMock->expects($this->once())->method('getPost')->will($this->returnValue(array('status_id' => 1))); $this->_objectManagerMock->expects($this->at(0))->method('get')->with('Magento\\Store\\Model\\StoreManagerInterface')->will($this->returnValue($this->_storeManagerInterfaceMock)); $this->_reviewFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->_reviewModelMock)); $this->_ratingFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->_ratingModelMock)); $this->_storeManagerInterfaceMock->expects($this->once())->method('hasSingleStore')->will($this->returnValue(true)); $this->_storeManagerInterfaceMock->expects($this->once())->method('getStore')->will($this->returnValue($this->_storeModelMock)); $this->_storeModelMock->expects($this->once())->method('getId')->will($this->returnValue(1)); $this->_reviewModelMock->expects($this->once())->method('save')->will($this->returnValue($this->_reviewModelMock)); $this->_reviewModelMock->expects($this->once())->method('getId')->will($this->returnValue(1)); $this->_reviewModelMock->expects($this->once())->method('aggregate')->will($this->returnValue($this->_reviewModelMock)); $this->_ratingModelMock->expects($this->once())->method('setRatingId')->will($this->returnSelf()); $this->_ratingModelMock->expects($this->once())->method('setReviewId')->will($this->returnSelf()); $this->_ratingModelMock->expects($this->once())->method('addOptionVote')->will($this->returnSelf()); $this->_helperMock->expects($this->once())->method('geturl')->will($this->returnValue('url')); $this->_model->execute(); }
/** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository) { parent::__construct($context, $coreRegistry, $reviewFactory, $ratingFactory); $this->productRepository = $productRepository; }