35 $this->sendfriendDataMock = $this->getMockBuilder(\
Magento\SendFriend\Helper\Data::class)
36 ->disableOriginalConstructor()
38 $this->cookieManagerMock = $this->createMock(\
Magento\Framework\Stdlib\CookieManagerInterface::class);
41 \
Magento\SendFriend\Model\SendFriend::class,
43 'sendfriendData' => $this->sendfriendDataMock,
44 'cookieManager' => $this->cookieManagerMock,
51 $cookieName =
'testCookieName';
52 $this->sendfriendDataMock->expects($this->once())->method(
'getLimitBy')->with()->will(
53 $this->returnValue(\
Magento\SendFriend\Helper\Data::CHECK_COOKIE)
55 $this->sendfriendDataMock->expects($this->once())->method(
'getCookieName')->with()->will(
56 $this->returnValue($cookieName)
59 $this->cookieManagerMock->expects($this->once())->method(
'getCookie')->with($cookieName);
60 $this->assertEquals(0, $this->model->getSentCount());
65 $cookieName =
'testCookieName';
66 $this->sendfriendDataMock->expects($this->once())->method(
'getCookieName')->with()->will(
67 $this->returnValue($cookieName)
70 $this->cookieManagerMock->expects($this->once())->method(
'getCookie')->with($cookieName);
71 $this->cookieManagerMock->expects($this->once())->method(
'setSensitiveCookie');
72 $sendFriendClass = new \ReflectionClass(\
Magento\SendFriend\Model\SendFriend::class);
73 $method = $sendFriendClass->getMethod(
'_sentCountByCookies');
75 $method->invokeArgs($this->model, [
true]);
testGetSentCountWithCheckCookie()