27 $this->productMock = $this->createPartialMock(
28 \
Magento\Catalog\Model\Product::class,
29 [
'getTypeId',
'setTypeId',
'setTypeInstance']
31 $this->weightResolver = $this->createMock(\
Magento\Catalog\Model\
Product\Edit\WeightResolver::class);
32 $this->model = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))
36 'weightResolver' => $this->weightResolver,
37 'compatibleTypes' => [
53 $this->productMock->expects($this->once())->method(
'getTypeId')->will($this->returnValue($currentTypeId));
54 $this->productMock->expects($this->once())->method(
'setTypeInstance')->with(
null);
55 $this->weightResolver->expects($this->once())->method(
'resolveProductHasWeight')->willReturn($hasWeight);
56 $this->productMock->expects($this->once())->method(
'setTypeId')->with($expectedTypeId);
57 $this->model->processProduct($this->productMock);
65 $this->productMock->expects($this->once())->method(
'getTypeId')->will($this->returnValue(
'wrong-type'));
66 $this->weightResolver->expects($this->never())->method(
'resolveProductHasWeight');
67 $this->model->processProduct($this->productMock);
78 \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL,
79 \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
83 \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
84 \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
88 \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
89 \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL,
93 \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL,
94 \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL,
processProductDataProvider()
testProcessProductWithWrongTypeId()
testProcessProduct($hasWeight, $currentTypeId, $expectedTypeId)