Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 /**
  * Initialize send friend model
  *
  * @return \Magento\Sendfriend\Model\Sendfriend
  */
 protected function _initSendToFriendModel()
 {
     $this->sendFriend->register();
     return $this->sendFriend;
 }
Ejemplo n.º 4
0
 /**
  * @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));
 }
Ejemplo n.º 5
0
 /**
  * @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());
 }
Ejemplo n.º 6
0
 /**
  * Check if user is allowed to send
  *
  * @return boolean
  */
 public function canSend()
 {
     return !$this->sendfriend->isExceedLimit();
 }