Example #1
0
 /**
  * @test
  * @dataProvider flvFileIsRecognizedDataProvider
  * @return void
  */
 public function flvFileIsRecognized($expected, $expectedOutput)
 {
     $mediaElement = new Media();
     $mediaElement->setMultimedia($expected);
     $renderer = new File();
     $this->assertEquals($expectedOutput, $renderer->enabled($mediaElement));
 }
 /**
  * @test
  * @dataProvider fileIsRecognizedDataProvider
  * @return void
  */
 public function flvFileIsRecognized($expected, $expectedOutput)
 {
     $mediaElement = new Media();
     $mediaElement->setMultimedia($expected);
     $mediaElement->setType(Media::MEDIA_TYPE_MULTIMEDIA);
     $renderer = new Videosites();
     $this->assertEquals($expectedOutput, $renderer->enabled($mediaElement));
 }
Example #3
0
 /**
  * Videosites implementation is always enabled if any file given,
  * the check is done in tslib_mediaWizardManager
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @return boolean
  */
 public function enabled(\GeorgRinger\News\Domain\Model\Media $element)
 {
     $result = TRUE;
     $file = $element->getContent();
     if (empty($file)) {
         $result = FALSE;
     }
     return $result;
 }
Example #4
0
 /**
  * Files with extension flv|mp4 are handled within this implementation
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @return bool
  */
 public function enabled(\GeorgRinger\News\Domain\Model\Media $element)
 {
     $url = FileService::getFalFilename($element->getMultimedia());
     $fileEnding = strtolower(substr($url, -3));
     $enabled = false;
     if ($fileEnding === 'flv' || $fileEnding === 'mp4') {
         $enabled = true;
     }
     return $enabled;
 }
Example #5
0
 /**
  * @test
  * @dataProvider fileIsRecognizedDataProvider
  * @return void
  */
 public function flvFileIsRecognized($expected, $expectedOutput)
 {
     $mediaElement = new Media();
     $mediaElement->setMultimedia($expected);
     $mediaElement->setType(Media::MEDIA_TYPE_MULTIMEDIA);
     $mockedSettingsService = $this->getMock('GeorgRinger\\News\\Service\\SettingsService', ['getSettings']);
     $renderer = $this->getAccessibleMock('GeorgRinger\\News\\MediaRenderer\\Video\\Youtube', ['dummy']);
     $renderer->_set('pluginSettingsService', $mockedSettingsService);
     $this->assertEquals($expectedOutput, $renderer->enabled($mediaElement));
 }
Example #6
0
File: Vimeo.php Project: r3h6/news
 /**
  * Get Vimeo url
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @return null|string
  */
 public function getVimeoUrl(\GeorgRinger\News\Domain\Model\Media $element)
 {
     $videoId = NULL;
     $vimeoUrl = NULL;
     if (preg_match('/vimeo.com\\/([0-9]+)/', $element->getContent(), $matches)) {
         $videoId = $matches[1];
     }
     if ($videoId) {
         $vimeoUrl = '//player.vimeo.com/video/' . $videoId . '';
     }
     return $vimeoUrl;
 }
Example #7
0
 /**
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @return null|string
  */
 public function getYoutubeUrl(\GeorgRinger\News\Domain\Model\Media $element)
 {
     $videoId = null;
     $youtubeUrl = null;
     if (preg_match('/(v=|v\\/|.be\\/)([^(\\&|$)]*)/', $element->getContent(), $matches)) {
         $videoId = $matches[2];
     }
     if ($videoId) {
         $youtubeUrl = '//www.youtube.com/embed/' . $videoId . '?fs=1&wmode=opaque';
         $settings = $this->pluginSettingsService->getSettings();
         if (isset($settings['mediaRenderer']) && isset($settings['mediaRenderer']['youtube']) && isset($settings['mediaRenderer']['youtube']['additionalParams'])) {
             $youtubeUrl .= $settings['mediaRenderer']['youtube']['additionalParams'];
         }
     }
     return $youtubeUrl;
 }
Example #8
0
 /**
  * Test if correct sub selection is returned
  *
  * @test
  * @return void
  */
 public function correctMediaSelectionIsReturned()
 {
     $imageElement1 = new Media();
     $imageElement1->setType(Media::MEDIA_TYPE_IMAGE);
     $imageElement2 = new Media();
     $imageElement2->setType(Media::MEDIA_TYPE_IMAGE);
     $imageElement3 = new Media();
     $imageElement3->setType(Media::MEDIA_TYPE_IMAGE);
     $multimediaElement1 = new Media();
     $multimediaElement1->setType(Media::MEDIA_TYPE_MULTIMEDIA);
     $news = new News();
     $news->addMedia($imageElement1);
     $news->addMedia($imageElement2);
     $news->addMedia($imageElement3);
     $news->addMedia($imageElement3);
     $news->addMedia($multimediaElement1);
     $this->assertEquals(3, count($news->getMediaTypeImage()));
     $this->assertEquals(1, count($news->getMediaTypeMultimedia()));
     $this->assertEquals(4, count($news->getMedia()));
 }
Example #9
0
File: Mp3.php Project: r3h6/news
 /**
  * Implementation is only used if file ending is mp3
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element media element
  * @return boolean
  */
 public function enabled(\GeorgRinger\News\Domain\Model\Media $element)
 {
     $url = FileService::getFalFilename($element->getContent());
     $fileEnding = strtolower(substr($url, -3));
     return $fileEnding === 'mp3';
 }
Example #10
0
 /**
  * Test if description can be set
  *
  * @test
  * @return void
  */
 public function descriptionCanBeSet()
 {
     $description = 'Some words';
     $this->mediaDomainModelInstance->setDescription($description);
     $this->assertEquals($description, $this->mediaDomainModelInstance->getDescription());
 }
Example #11
0
 /**
  * Get a unique container id
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @return string
  */
 public static function getUniqueId(\GeorgRinger\News\Domain\Model\Media $element)
 {
     return 'mediaelement-' . md5($element->getUid() . uniqid());
 }