|
7 | 7 | */
|
8 | 8 | namespace Magento\Bundle\Test\Unit\Controller\Adminhtml\Product\Initialization\Helper\Plugin;
|
9 | 9 |
|
| 10 | +use Magento\Catalog\Api\Data\ProductExtensionInterface; |
| 11 | + |
10 | 12 | class BundleTest extends \PHPUnit\Framework\TestCase
|
11 | 13 | {
|
12 | 14 | /**
|
@@ -57,7 +59,10 @@ protected function setUp()
|
57 | 59 | 'setOptions',
|
58 | 60 | 'setCanSaveBundleSelections',
|
59 | 61 | '__wakeup',
|
60 |
| - 'getOptionsReadonly' |
| 62 | + 'getOptionsReadonly', |
| 63 | + 'getBundleOptionsData', |
| 64 | + 'getExtensionAttributes', |
| 65 | + 'setExtensionAttributes', |
61 | 66 | ];
|
62 | 67 | $this->productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, $methods);
|
63 | 68 | $optionInterfaceFactory = $this->getMockBuilder(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class)
|
@@ -127,6 +132,15 @@ public function testAfterInitializeIfBundleAnsCustomOptionsAndBundleSelectionsEx
|
127 | 132 | );
|
128 | 133 | $this->productMock->expects($this->once())->method('setOptions')->with(null);
|
129 | 134 | $this->productMock->expects($this->once())->method('setCanSaveBundleSelections')->with(true);
|
| 135 | + $this->productMock->expects($this->once())->method('getBundleOptionsData')->willReturn(['option_1' => ['delete' => 1]]); |
| 136 | + $extentionAttribute = $this->getMockBuilder(ProductExtensionInterface::class) |
| 137 | + ->disableOriginalConstructor() |
| 138 | + ->setMethods(['setBundleProductOptions']) |
| 139 | + ->getMockForAbstractClass(); |
| 140 | + $extentionAttribute->expects($this->once())->method('setBundleProductOptions')->with([]); |
| 141 | + $this->productMock->expects($this->once())->method('getExtensionAttributes')->willReturn($extentionAttribute); |
| 142 | + $this->productMock->expects($this->once())->method('setExtensionAttributes')->with($extentionAttribute); |
| 143 | + |
130 | 144 | $this->model->afterInitialize($this->subjectMock, $this->productMock);
|
131 | 145 | }
|
132 | 146 |
|
|
0 commit comments