Esempio n. 1
0
 public function testBeforeSave()
 {
     $websiteId = 1;
     $object = $this->getMockBuilder('Magento\\Framework\\Object')->disableOriginalConstructor()->setMethods(['hasData', 'setData'])->getMock();
     $store = $this->getMockBuilder('Magento\\Framework\\Object')->setMethods(['getWebsiteId'])->getMock();
     $store->expects($this->once())->method('getWebsiteId')->will($this->returnValue($websiteId));
     $this->storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store));
     $object->expects($this->once())->method('hasData')->with('website_id')->will($this->returnValue(false));
     $object->expects($this->once())->method('setData')->with($this->logicalOr('website_id', $websiteId))->will($this->returnSelf());
     /** @var \Magento\Framework\Object $object */
     $this->assertInstanceOf('Magento\\Customer\\Model\\Customer\\Attribute\\Backend\\Website', $this->testable->beforeSave($object));
 }