38 $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
39 $this->objectManagerHelper =
new ObjectManagerHelper($this);
41 $taxClass = $this->getMockBuilder(\
Magento\Tax\Model\ClassModel::class)
42 ->disableOriginalConstructor()
44 $taxClass->method(
'getClassName')->will($this->returnValue(self::TEST_TAX_CLASS_NAME));
45 $taxClass->method(
'getId')->will($this->returnValue(self::TEST_TAX_CLASS_ID));
48 $this->objectManagerHelper->getCollectionMock(
53 $taxClassCollectionFactory = $this->createPartialMock(
58 $taxClassCollectionFactory->method(
'create')->will($this->returnValue($taxClassCollection));
60 $anotherTaxClass = $this->getMockBuilder(\
Magento\Tax\Model\ClassModel::class)
61 ->disableOriginalConstructor()
63 $anotherTaxClass->method(
'getClassName')->will($this->returnValue(self::TEST_TAX_CLASS_NAME));
64 $anotherTaxClass->method(
'getId')->will($this->returnValue(self::TEST_JUST_CREATED_TAX_CLASS_ID));
66 $taxClassFactory = $this->createPartialMock(\
Magento\Tax\Model\ClassModelFactory::class, [
'create']);
68 $taxClassFactory->method(
'create')->will($this->returnValue($anotherTaxClass));
70 $this->taxClassProcessor =
71 new \Magento\CatalogImportExport\Model\Import\Product\TaxClassProcessor(
72 $taxClassCollectionFactory,
77 $this->getMockForAbstractClass(
87 $taxClassId = $this->taxClassProcessor->upsertTaxClass(self::TEST_TAX_CLASS_NAME, $this->product);
88 $this->assertEquals(self::TEST_TAX_CLASS_ID, $taxClassId);
93 $taxClassId = $this->taxClassProcessor->upsertTaxClass(
'noExistClassName', $this->product);
94 $this->assertEquals(self::TEST_JUST_CREATED_TAX_CLASS_ID, $taxClassId);
const TEST_JUST_CREATED_TAX_CLASS_ID
testUpsertTaxClassExist()
const TEST_TAX_CLASS_NAME
testUpsertTaxClassNotExist()