public function testBeforeSave() { $object = $this->getMockBuilder('Magento\\Framework\\Object')->disableOriginalConstructor()->setMethods(array('getDefaultBilling', 'unsetDefaultBilling'))->getMock(); $object->expects($this->once())->method('getDefaultBilling')->will($this->returnValue(null)); $object->expects($this->once())->method('unsetDefaultBilling')->will($this->returnSelf()); /** @var \Magento\Framework\Object $object */ $this->testable->beforeSave($object); }