public function testAfterInitializeIfBundleSelectionsAndCustomOptionsExist()
 {
     $bundleOptionsRawWithoutSelections = $this->bundleOptionsRaw;
     $bundleOptionsRawWithoutSelections['bundle_options'][0]['bundle_selections'] = false;
     $valueMap = [['bundle_options', null, $bundleOptionsRawWithoutSelections], ['affect_bundle_product_selections', null, false]];
     $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap));
     $this->productMock->expects($this->any())->method('getCompositeReadonly')->will($this->returnValue(false));
     $this->productMock->expects($this->never())->method('setBundleOptionsData')->with($this->bundleOptionsCleaned);
     $this->productMock->expects($this->never())->method('setBundleSelectionsData');
     $this->productMock->expects($this->once())->method('getPriceType')->will($this->returnValue(2));
     $this->productMock->expects($this->any())->method('getOptionsReadonly')->will($this->returnValue(true));
     $this->productMock->expects($this->once())->method('setCanSaveBundleSelections')->with(false);
     $this->model->afterInitialize($this->subjectMock, $this->productMock);
 }
Example #2
0
 public function testAfterInitializeIfCustomAndBundleOptionNotExist()
 {
     $postValue = 'postValue';
     $valueMap = [['bundle_options', null, false], ['bundle_selections', null, $postValue], ['affect_bundle_product_selections', null, 1]];
     $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap));
     $this->productMock->expects($this->any())->method('getCompositeReadonly')->will($this->returnValue(false));
     $this->productMock->expects($this->never())->method('setBundleOptionsData');
     $this->productMock->expects($this->once())->method('setBundleSelectionsData')->with($postValue);
     $this->productMock->expects($this->once())->method('getPriceType')->will($this->returnValue(0));
     $this->productMock->expects($this->any())->method('getOptionsReadonly')->will($this->returnValue(false));
     $this->productMock->expects($this->once())->method('setCanSaveCustomOptions')->with(true);
     $this->productMock->expects($this->once())->method('getProductOptions')->will($this->returnValue(false));
     $this->productMock->expects($this->never())->method('setProductOptions');
     $this->productMock->expects($this->once())->method('setCanSaveBundleSelections')->with(true);
     $this->model->afterInitialize($this->subjectMock, $this->productMock);
 }