CustomerLogoutTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Wishlist\Test\Unit\Observer;
  7. use \Magento\Wishlist\Observer\CustomerLogout as Observer;
  8. class CustomerLogoutTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * @var Observer
  12. */
  13. protected $observer;
  14. /**
  15. * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject
  16. */
  17. protected $customerSession;
  18. protected function setUp()
  19. {
  20. $this->customerSession = $this->getMockBuilder(\Magento\Customer\Model\Session::class)
  21. ->disableOriginalConstructor()
  22. ->setMethods(['setWishlistItemCount', 'isLoggedIn', 'getCustomerId'])
  23. ->getMock();
  24. $this->observer = new Observer(
  25. $this->customerSession
  26. );
  27. }
  28. public function testExecute()
  29. {
  30. $event = $this->getMockBuilder(\Magento\Framework\Event\Observer::class)
  31. ->disableOriginalConstructor()
  32. ->getMock();
  33. /** @var $event \Magento\Framework\Event\Observer */
  34. $this->customerSession->expects($this->once())
  35. ->method('setWishlistItemCount')
  36. ->with($this->equalTo(0));
  37. $this->observer->execute($event);
  38. }
  39. }