本文整理匯總了PHP中Magento\Framework\TestFramework\Unit\Helper\ObjectManager::convertFrom方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectManager::convertFrom方法的具體用法?PHP ObjectManager::convertFrom怎麽用?PHP ObjectManager::convertFrom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\TestFramework\Unit\Helper\ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::convertFrom方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testConvertFrom
public function testConvertFrom()
{
$this->mediaGalleryEntryMock->expects($this->once())->method('getId')->willReturn('4');
$this->mediaGalleryEntryMock->expects($this->once())->method('getFile')->willReturn('/i/n/index111111.jpg');
$this->mediaGalleryEntryMock->expects($this->once())->method('getLabel')->willReturn('Some Label');
$this->mediaGalleryEntryMock->expects($this->once())->method('getPosition')->willReturn('3');
$this->mediaGalleryEntryMock->expects($this->once())->method('isDisabled')->willReturn('0');
$this->mediaGalleryEntryMock->expects($this->once())->method('getTypes')->willReturn([]);
$this->mediaGalleryEntryMock->expects($this->once())->method('getContent')->willReturn(null);
$this->mediaGalleryEntryMock->expects($this->once())->method('getExtensionAttributes')->willReturn($this->mediaGalleryEntryExtensionMock);
$videoContentMock = $this->getMock('Magento\\ProductVideo\\Model\\Product\\Attribute\\Media\\VideoEntry', [], [], '', false);
$videoContentMock->expects($this->once())->method('getVideoProvider')->willReturn('youtube');
$videoContentMock->expects($this->once())->method('getVideoUrl')->willReturn('https://www.youtube.com/watch?v=abcdefghij');
$videoContentMock->expects($this->once())->method('getVideoTitle')->willReturn('Some video title');
$videoContentMock->expects($this->once())->method('getVideoDescription')->willReturn('Some video description');
$videoContentMock->expects($this->once())->method('getVideoMetadata')->willReturn('Meta data');
$this->mediaGalleryEntryExtensionMock->expects($this->once())->method('getVideoContent')->willReturn($videoContentMock);
$expectedResult = ['value_id' => '4', 'file' => '/i/n/index111111.jpg', 'label' => 'Some Label', 'position' => '3', 'disabled' => '0', 'types' => [], 'media_type' => null, 'content' => null, 'video_provider' => 'youtube', 'video_url' => 'https://www.youtube.com/watch?v=abcdefghij', 'video_title' => 'Some video title', 'video_description' => 'Some video description', 'video_metadata' => 'Meta data'];
$result = $this->modelObject->convertFrom($this->mediaGalleryEntryMock);
$this->assertEquals($expectedResult, $result);
}