42 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
44 $this->request = $this->createMock(\
Magento\Framework\
App\RequestInterface::class);
46 $this->wishlistFactory = $this->createPartialMock(\
Magento\Wishlist\Model\WishlistFactory::class, [
'create']);
48 $this->customerSession = $this->createPartialMock(\
Magento\Customer\Model\Session::class, [
'getCustomerId']);
50 $this->messageManager = $this->createMock(\
Magento\Framework\Message\ManagerInterface::class);
53 \
Magento\Wishlist\Controller\WishlistProvider::class,
55 'request' => $this->request,
56 'wishlistFactory' => $this->wishlistFactory,
57 'customerSession' => $this->customerSession,
58 'messageManager' => $this->messageManager
67 $this->wishlistFactory->expects($this->once())
71 $this->assertEquals(
$wishlist, $this->wishlistProvider->getWishlist());
77 \
Magento\Wishlist\Model\Wishlist::class,
78 [
'loadByCustomerId',
'getId',
'getCustomerId',
'__wakeup']
81 ->method(
'loadByCustomerId')
82 ->will($this->returnSelf());
85 ->will($this->returnValue(1));
87 ->method(
'getCustomerId')
88 ->will($this->returnValue(1));
90 $this->wishlistFactory->expects($this->once())
94 $this->customerSession->expects($this->once())
95 ->method(
'getCustomerId')
96 ->will($this->returnValue(1));
98 $this->assertEquals(
$wishlist, $this->wishlistProvider->getWishlist());
104 \
Magento\Wishlist\Model\Wishlist::class,
105 [
'loadByCustomerId',
'load',
'getId',
'getCustomerId',
'__wakeup']
110 ->will($this->returnSelf());
113 ->will($this->returnValue(1));
115 ->method(
'getCustomerId')
116 ->will($this->returnValue(1));
118 $this->wishlistFactory->expects($this->once())
122 $this->request->expects($this->once())
124 ->will($this->returnValue(1));
126 $this->customerSession->expects($this->once())
127 ->method(
'getCustomerId')
128 ->will($this->returnValue(1));
130 $this->assertEquals(
$wishlist, $this->wishlistProvider->getWishlist());
136 \
Magento\Wishlist\Model\Wishlist::class,
137 [
'loadByCustomerId',
'load',
'getId',
'getCustomerId',
'__wakeup']
142 ->will($this->returnSelf());
145 ->will($this->returnValue(1));
147 ->method(
'getCustomerId')
148 ->will($this->returnValue(1));
150 $this->wishlistFactory->expects($this->once())
154 $this->request->expects($this->once())
156 ->will($this->returnValue(1));
158 $this->assertEquals(
false, $this->wishlistProvider->getWishlist());
testGetWishlistWithCustomer()
testGetWishlistWithIdWithoutCustomer()
testGetWishlistWithIdAndCustomer()