/** * @param \Magento\Catalog\Block\Product\View $subject * @param bool $result * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterCanEmailToFriend(\Magento\Catalog\Block\Product\View $subject, $result) { if (!$result) { $result = $this->_sendfriend->canEmailToFriend(); } return $result; }
public function testGetSentCountWithCheckCookie() { $cookieName = 'testCookieName'; $this->sendfriendDataMock->expects($this->once())->method('getLimitBy')->with()->will($this->returnValue(\Magento\Sendfriend\Helper\Data::CHECK_COOKIE)); $this->sendfriendDataMock->expects($this->once())->method('getCookieName')->with()->will($this->returnValue($cookieName)); $this->cookieManagerMock->expects($this->once())->method('getCookie')->with($cookieName); $this->assertEquals(0, $this->model->getSentCount()); }
/** * Initialize send friend model * * @return \Magento\Sendfriend\Model\Sendfriend */ protected function _initSendToFriendModel() { $this->sendFriend->register(); return $this->sendFriend; }
/** * @dataProvider afterCanEmailToFriendDataSet * @param bool $result * @param string $callSendfriend */ public function testAfterCanEmailToFriend($result, $callSendfriend) { $this->sendfriendModel->expects($this->{$callSendfriend}())->method('canEmailToFriend')->will($this->returnValue(true)); $this->assertTrue($this->view->afterCanEmailToFriend($this->productView, $result)); }
/** * @param bool $isExceedLimit * @param bool $result * * @dataProvider dataProviderCanSend */ public function testCanSend($isExceedLimit, $result) { $this->sendfriendMock->expects($this->once())->method('isExceedLimit')->willReturn($isExceedLimit); $this->assertEquals($result, $this->model->canSend()); }
/** * Check if user is allowed to send * * @return boolean */ public function canSend() { return !$this->sendfriend->isExceedLimit(); }