PluginTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Multishipping\Test\Unit\Controller\Checkout;
  8. use Magento\Multishipping\Controller\Checkout\Plugin;
  9. class PluginTest extends \PHPUnit\Framework\TestCase
  10. {
  11. /**
  12. * @var \PHPUnit_Framework_MockObject_MockObject
  13. */
  14. protected $cartMock;
  15. /**
  16. * @var \PHPUnit_Framework_MockObject_MockObject
  17. */
  18. protected $quoteMock;
  19. /**
  20. * @var Plugin
  21. */
  22. protected $object;
  23. protected function setUp()
  24. {
  25. $this->cartMock = $this->createMock(\Magento\Checkout\Model\Cart::class);
  26. $this->quoteMock = $this->createPartialMock(
  27. \Magento\Quote\Model\Quote::class,
  28. ['__wakeUp', 'setIsMultiShipping']
  29. );
  30. $this->cartMock->expects($this->once())->method('getQuote')->will($this->returnValue($this->quoteMock));
  31. $this->object = new \Magento\Multishipping\Controller\Checkout\Plugin($this->cartMock);
  32. }
  33. public function testExecuteTurnsOffMultishippingModeOnQuote()
  34. {
  35. $subject = $this->createMock(\Magento\Checkout\Controller\Index\Index::class);
  36. $this->quoteMock->expects($this->once())->method('setIsMultiShipping')->with(0);
  37. $this->object->beforeExecute($subject);
  38. }
  39. }