Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TaxSetupTest.php
Go to the documentation of this file.
1 <?php
7 
8 class TaxSetupTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $taxSetup;
14 
18  protected $typeConfigMock;
19 
20  protected function setUp()
21  {
22  $this->typeConfigMock = $this->createMock(\Magento\Catalog\Model\ProductTypes\ConfigInterface::class);
23 
24  $salesSetup = $this->createMock(\Magento\Sales\Setup\SalesSetup::class);
25  $salesSetupFactory = $this->createPartialMock(\Magento\Sales\Setup\SalesSetupFactory::class, ['create']);
26  $salesSetupFactory->expects($this->any())->method('create')->will($this->returnValue($salesSetup));
27 
28  $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
29  $this->taxSetup = $helper->getObject(
30  \Magento\Tax\Setup\TaxSetup::class,
31  [
32  'productTypeConfig' => $this->typeConfigMock,
33  'salesSetupFactory' => $salesSetupFactory,
34  ]
35  );
36  }
37 
38  public function testGetTaxableItems()
39  {
40  $refundable = ['simple', 'simple2'];
41  $this->typeConfigMock->expects(
42  $this->once()
43  )->method(
44  'filter'
45  )->with(
46  'taxable'
47  )->will(
48  $this->returnValue($refundable)
49  );
50  $this->assertEquals($refundable, $this->taxSetup->getTaxableItems());
51  }
52 }
$helper
Definition: iframe.phtml:13