/** * @test * @dataProvider flvFileIsRecognizedDataProvider * @return void */ public function flvFileIsRecognized($expected, $expectedOutput) { $mediaElement = new Tx_MooxNews_Domain_Model_Media(); $mediaElement->setMultimedia($expected); $renderer = new Tx_MooxNews_MediaRenderer_Video_File(); $this->assertEquals($expectedOutput, $renderer->enabled($mediaElement)); }
/** * @test * @dataProvider fileIsRecognizedDataProvider * @return void */ public function VimeoLinkIsRecognized($expected, $expectedOutput) { $mediaElement = new Tx_MooxNews_Domain_Model_Media(); $mediaElement->setMultimedia($expected); $mediaElement->setType(Tx_MooxNews_Domain_Model_Media::MEDIA_TYPE_MULTIMEDIA); $renderer = new Tx_MooxNews_MediaRenderer_Video_Vimeo(); $this->assertEquals($expectedOutput, $renderer->enabled($mediaElement)); }
/** * Videosites implementation is always enabled if any file given, * the check is done in tslib_mediaWizardManager * * @param Tx_MooxNews_Domain_Model_Media $element * @return boolean */ public function enabled(Tx_MooxNews_Domain_Model_Media $element) { $result = TRUE; $file = $element->getContent(); if (empty($file)) { $result = FALSE; } return $result; }
/** * Files with extension flv|mp4 are handled within this implementation * * @param Tx_MooxNews_Domain_Model_Media $element * @return boolean */ public function enabled(Tx_MooxNews_Domain_Model_Media $element) { $url = Tx_MooxNews_Service_FileService::getFalFilename($element->getMultimedia()); $fileEnding = strtolower(substr($url, -3)); $enabled = FALSE; if ($fileEnding === 'flv' || $fileEnding === 'mp4') { $enabled = TRUE; } return $enabled; }
/** * @param Tx_MooxNews_Domain_Model_Media $element * @return null|string */ public function getYoutubeUrl(Tx_MooxNews_Domain_Model_Media $element) { $videoId = NULL; $youtubeUrl = NULL; if (preg_match('/(v=|v\\/|.be\\/)([^(\\&|$)]*)/', $element->getContent(), $matches)) { $videoId = $matches[2]; } if ($videoId) { $youtubeUrl = 'http://www.youtube.com/embed/' . $videoId . '?fs=1&wmode=opaque'; } return $youtubeUrl; }
/** * Get Vimeo url * * @param Tx_MooxNews_Domain_Model_Media $element * @return null|string */ public function getVimeoUrl(Tx_MooxNews_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; }
/** * Implementation is used if file extension is mov * * @param Tx_MooxNews_Domain_Model_Media $element * @return boolean */ public function enabled(Tx_MooxNews_Domain_Model_Media $element) { $url = $element->getContent(); $fileEnding = strtolower(substr($url, -3)); return $fileEnding === 'mov'; }
/** * 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()); }
/** * Get a unique container id * * @param Tx_MooxNews_Domain_Model_Media $element * @return string */ public static function getUniqueId(Tx_MooxNews_Domain_Model_Media $element) { return 'mediaelement-' . md5($element->getUid() . uniqid()); }
/** * Implementation is only used if file ending is mp3 * * @param Tx_MooxNews_Domain_Model_Media $element media element * @return boolean */ public function enabled(Tx_MooxNews_Domain_Model_Media $element) { $url = Tx_MooxNews_Service_FileService::getFalFilename($element->getContent()); $fileEnding = strtolower(substr($url, -3)); return $fileEnding === 'mp3'; }
/** * Test if correct sub selection is returned * * @test * @return void */ public function correctMediaSelectionIsReturned() { $imageElement1 = new Tx_MooxNews_Domain_Model_Media(); $imageElement1->setType(Tx_MooxNews_Domain_Model_Media::MEDIA_TYPE_IMAGE); $imageElement2 = new Tx_MooxNews_Domain_Model_Media(); $imageElement2->setType(Tx_MooxNews_Domain_Model_Media::MEDIA_TYPE_IMAGE); $imageElement3 = new Tx_MooxNews_Domain_Model_Media(); $imageElement3->setType(Tx_MooxNews_Domain_Model_Media::MEDIA_TYPE_IMAGE); $multimediaElement1 = new Tx_MooxNews_Domain_Model_Media(); $multimediaElement1->setType(Tx_MooxNews_Domain_Model_Media::MEDIA_TYPE_MULTIMEDIA); $news = new Tx_MooxNews_Domain_Model_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())); }