Example #1
0
 /**
  * @dataProvider getOptionsDataProvider
  */
 public function testRemoveOptionByCode($code, $option)
 {
     $this->assertEmpty($this->model->getOptions());
     $optionMock = $this->getMockBuilder('Magento\\Wishlist\\Model\\Item\\Option')->disableOriginalConstructor()->setMethods(['setData', 'getCode', '__wakeup'])->getMock();
     $optionMock->expects($this->any())->method('setData')->willReturnSelf();
     $optionMock->expects($this->any())->method('getCode')->willReturn($code);
     $this->optionFactory->expects($this->any())->method('create')->willReturn($optionMock);
     $this->model->addOption($option);
     $this->assertEquals(1, count($this->model->getOptions()));
     $this->model->removeOption($code);
     $actualOptions = $this->model->getOptions();
     $actualOption = array_pop($actualOptions);
     $this->assertTrue($actualOption->isDeleted());
 }