/**
  * Test getVideoSettingsJson
  */
 public function testGetVideoSettingsJson()
 {
     $this->mediaHelperMock->expects($this->once())->method('getPlayIfBaseAttribute')->willReturn(1);
     $this->mediaHelperMock->expects($this->once())->method('getShowRelatedAttribute')->willReturn(0);
     $this->mediaHelperMock->expects($this->once())->method('getVideoAutoRestartAttribute')->willReturn(0);
     $this->gallery->getVideoSettingsJson();
 }
Exemple #2
0
 /**
  * Get note for video url
  *
  * @return \Magento\Framework\Phrase
  */
 protected function getNoteVideoUrl()
 {
     $result = __('YouTube and Vimeo supported.');
     if ($this->mediaHelper->getYouTubeApiKey() === null) {
         $result = __('Vimeo supported.<br />' . 'To add YouTube video, please <a href="%1">enter YouTube API Key</a> first.', $this->getConfigApiKeyUrl());
     }
     return $result;
 }
 /**
  * Get widget options
  *
  * @return string
  */
 public function getWidgetOptions()
 {
     return $this->jsonEncoder->encode(['saveVideoUrl' => $this->getUrl('catalog/product_gallery/upload'), 'saveRemoteVideoUrl' => $this->getUrl('product_video/product_gallery/retrieveImage'), 'htmlId' => $this->getHtmlId(), 'youTubeApiKey' => $this->mediaHelper->getYouTubeApiKey()]);
 }
 /**
  * Retrieve video settings data in JSON format
  *
  * @return string
  */
 public function getVideoSettingsJson()
 {
     $videoSettingData[] = ['playIfBase' => $this->mediaHelper->getPlayIfBaseAttribute(), 'showRelated' => $this->mediaHelper->getShowRelatedAttribute(), 'videoAutoRestart' => $this->mediaHelper->getVideoAutoRestartAttribute()];
     return $this->jsonEncoder->encode($videoSettingData);
 }
 /**
  * @dataProvider dataForVideoBackground
  */
 public function testGetVideoAutoRestartAttribute($expectedResult)
 {
     $this->viewConfigMock->expects($this->once())->method('getMediaAttributes')->willReturn($expectedResult);
     $this->mediaHelperObject->getVideoAutoRestartAttribute();
 }
 /**
  * Test for method getYouTubeApiKey
  */
 public function testGetYouTubeApiKey()
 {
     $return = 'some_value';
     $this->scopeConfigMock->expects($this->once())->method('getValue')->with(Media::XML_PATH_YOUTUBE_API_KEY)->will($this->returnValue($return));
     $this->assertEquals($return, $this->helper->getYouTubeApiKey());
 }