本文整理匯總了PHP中Website::beforeSave方法的典型用法代碼示例。如果您正苦於以下問題:PHP Website::beforeSave方法的具體用法?PHP Website::beforeSave怎麽用?PHP Website::beforeSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Website
的用法示例。
在下文中一共展示了Website::beforeSave方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testBeforeSave
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));
}