protected function setUp() { $this->option = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Option', [], [], '', false); $this->optionFactory = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\OptionFactory', ['create'], [], '', false); $this->optionFactory->expects($this->any())->method('create')->will($this->returnValue($this->option)); $this->attribute = $this->getMock('Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute', [], [], '', false); $this->model = (new ObjectManager($this))->getObject('Magento\\Bundle\\Model\\Product\\Attribute\\Source\\Price\\View', ['optionFactory' => $this->optionFactory]); $this->model->setAttribute($this->attribute); }