當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ObjectManager::afterBeforeSave方法代碼示例

本文整理匯總了PHP中Magento\Framework\TestFramework\Unit\Helper\ObjectManager::afterBeforeSave方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectManager::afterBeforeSave方法的具體用法?PHP ObjectManager::afterBeforeSave怎麽用?PHP ObjectManager::afterBeforeSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\TestFramework\Unit\Helper\ObjectManager的用法示例。


在下文中一共展示了ObjectManager::afterBeforeSave方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testBeforeSave

 public function testBeforeSave()
 {
     $mediaData = ['images' => ['72mljfhmasfilp9cuq' => ['position' => '3', 'media_type' => 'external-video', 'file' => '/i/n/index111111.jpg', 'value_id' => '4', 'label' => '', 'disabled' => '0', 'removed' => '', 'video_provider' => 'youtube', 'video_url' => 'https://www.youtube.com/watch?v=abcdefghij', 'video_title' => 'Some second title', 'video_description' => 'Description second', 'video_metadata' => 'meta two', 'role' => ''], 'w596fi79hv1p6wj21u' => ['position' => '4', 'media_type' => 'external-video', 'video_provider' => '', 'file' => '/h/d/hd_image.jpg', 'value_id' => '7', 'label' => '', 'disabled' => '0', 'removed' => '', 'video_url' => '', 'video_title' => '', 'video_description' => '', 'video_metadata' => '', 'role' => ''], 'tcodwd7e0dirifr64j' => ['position' => '4', 'media_type' => 'external-video', 'video_provider' => '', 'file' => '/h/d/hd_image.jpg', 'value_id' => '', 'label' => '', 'disabled' => '0', 'removed' => '', 'video_url' => '', 'video_title' => '', 'video_description' => '', 'video_metadata' => '', 'role' => '', 'save_data_from' => '7', 'new_file' => '/i/n/index_4.jpg']]];
     $this->productMock->expects($this->any())->method('getData')->with('media_gallery')->willReturn($mediaData);
     $this->productMock->expects($this->any())->method('getStoreId')->willReturn(0);
     $resourceEntryResult = [['value_id' => '4', 'store_id' => 1, 'video_provider_default' => 'youtube', 'video_url_default' => 'https://www.youtube.com/watch?v=abcdefghij', 'video_title_default' => 'Some first title', 'video_description_default' => 'Description first', 'video_metadata_default' => 'meta one', 'video_provider' => 'youtube', 'video_url' => 'https://www.youtube.com/watch?v=abcdefghij', 'video_title' => 'Some first title', 'video_description' => 'Description first', 'video_metadata' => 'meta one'], ['value_id' => '7', 'store_id' => 1, 'video_provider_default' => 'youtube', 'video_url_default' => 'https://www.youtube.com/watch?v=ab123456', 'video_title_default' => 'Some second title', 'video_description_default' => 'Description second', 'video_metadata_default' => 'meta two', 'video_provider' => 'youtube', 'video_url' => 'https://www.youtube.com/watch?v=ab123456', 'video_title' => 'Some second title', 'video_description' => 'Description second', 'video_metadata' => '']];
     $this->resourceEntryMediaGalleryMock->expects($this->once())->method('loadDataFromTableByValueId')->willReturn($resourceEntryResult);
     $this->mediaBackendModel->expects($this->any())->method('getAttribute')->willReturn($this->attributeMock);
     $this->modelObject->afterBeforeSave($this->mediaBackendModel, $this->productMock);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:10,代碼來源:ExternalVideoEntryProcessorTest.php


注:本文中的Magento\Framework\TestFramework\Unit\Helper\ObjectManager::afterBeforeSave方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。