[BUGFIX] Fix url for youtube embeds
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Tests / Unit / MediaWizard / MediaWizardProviderTest.php
1 <?php
2 namespace TYPO3\CMS\Frontend\Tests\Unit\MediaWizard;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2009-2013 Sebastian Fischer (typo3@marketing-factory.de)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26 /**
27 * Testcase for TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider
28 *
29 * @author Sebastian Fischer <typo3@marketing-factory.de>
30 */
31 class MediaWizardProviderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
32
33 /**
34 * @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\TYPO3\CMS\Frontend\MediaWizard\MediaWizardProvider
35 */
36 protected $fixture;
37
38 /**
39 * Setup
40 */
41 public function setUp() {
42 $this->fixture = $this->getAccessibleMock('\\TYPO3\\CMS\\Frontend\\MediaWizard\\MediaWizardProvider', array('dummy'), array(), '', FALSE);
43 }
44
45 /**
46 * @return array
47 */
48 public function process_youtubeDataProvider() {
49 return array(
50 'http://youtu.be/2PMeCSQ--08' => array(
51 'http://youtu.be/2PMeCSQ--08',
52 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
53 ),
54 'http://www.youtube.com/embed/2PMeCSQ--08' => array(
55 'http://www.youtube.com/embed/2PMeCSQ--08',
56 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
57 ),
58 'http://www.youtube.com/watch?v=2PMeCSQ--08' => array(
59 'http://www.youtube.com/watch?v=2PMeCSQ--08',
60 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
61 ),
62 'http://www.youtube.com/?v=2PMeCSQ--08' => array(
63 'http://www.youtube.com/?v=2PMeCSQ--08',
64 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
65 ),
66 'http://www.youtube.com/v/2PMeCSQ--08' => array(
67 'http://www.youtube.com/v/2PMeCSQ--08',
68 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
69 ),
70 'http://www.youtube.com/e/2PMeCSQ--08' => array(
71 'http://www.youtube.com/e/2PMeCSQ--08',
72 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
73 ),
74 'http://www.youtube.com/watch?feature=player_embedded&v=2PMeCSQ--08' => array(
75 'http://www.youtube.com/watch?feature=player_embedded&v=2PMeCSQ--08',
76 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
77 ),
78 'http://www.youtube.com/watch?v=2PMeCSQ--08&list=PLGWGc5dfbzn_pvtJg7XskLva9XZpNTI88' => array(
79 'http://www.youtube.com/watch?v=2PMeCSQ--08&list=PLGWGc5dfbzn_pvtJg7XskLva9XZpNTI88',
80 'http://www.youtube.com/v/2PMeCSQ--08?fs=1'
81 ),
82 );
83 }
84
85 /**
86 * Test for process youtube
87 *
88 * @param string $url
89 * @param string $expected
90 * @return void
91 * @dataProvider process_youtubeDataProvider
92 * @test
93 */
94 public function process_youtube($url, $expected) {
95 $result = $this->fixture->_call('process_youtube', $url);
96 $this->assertEquals($expected, $result);
97 }
98 }