TaxSetupTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Test\Unit\Setup;
  7. class TaxSetupTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Tax\Setup\TaxSetup
  11. */
  12. protected $taxSetup;
  13. /**
  14. * @var \PHPUnit_Framework_MockObject_MockObject
  15. */
  16. protected $typeConfigMock;
  17. protected function setUp()
  18. {
  19. $this->typeConfigMock = $this->createMock(\Magento\Catalog\Model\ProductTypes\ConfigInterface::class);
  20. $salesSetup = $this->createMock(\Magento\Sales\Setup\SalesSetup::class);
  21. $salesSetupFactory = $this->createPartialMock(\Magento\Sales\Setup\SalesSetupFactory::class, ['create']);
  22. $salesSetupFactory->expects($this->any())->method('create')->will($this->returnValue($salesSetup));
  23. $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  24. $this->taxSetup = $helper->getObject(
  25. \Magento\Tax\Setup\TaxSetup::class,
  26. [
  27. 'productTypeConfig' => $this->typeConfigMock,
  28. 'salesSetupFactory' => $salesSetupFactory,
  29. ]
  30. );
  31. }
  32. public function testGetTaxableItems()
  33. {
  34. $refundable = ['simple', 'simple2'];
  35. $this->typeConfigMock->expects(
  36. $this->once()
  37. )->method(
  38. 'filter'
  39. )->with(
  40. 'taxable'
  41. )->will(
  42. $this->returnValue($refundable)
  43. );
  44. $this->assertEquals($refundable, $this->taxSetup->getTaxableItems());
  45. }
  46. }