1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8require_once(__DIR__ . '/../../wiki-plugins/wikiplugin_youtube.php'); 9 10class WikiPlugin_YoutubeTest extends PHPUnit_Framework_TestCase 11{ 12 /** 13 * @dataProvider provider 14 */ 15 public function testWikiPluginCode($data, $expectedOutput, $params = []) 16 { 17 $this->assertEquals($expectedOutput, wikiplugin_youtube($data, $params)); 18 } 19 20 public function provider() 21 { 22 return [ 23 ['', '^Plugin YouTube error: the movie parameter is empty.'], 24 ['', '~np~<iframe src="//www.youtube.com/embed/bPHuY7QL568?" frameborder="0" width="425" height="350" allowfullscreen=""></iframe>~/np~', ['movie' => 'http://www.youtube.com/watch?v=bPHuY7QL568']], 25 ['', '~np~<iframe src="//www.youtube.com/embed/deby_Yb1-ac?" frameborder="0" width="425" height="350" allowfullscreen=""></iframe>~/np~', ['movie' => 'https://www.youtube.com/watch?v=deby_Yb1-ac']], 26 ['', '~np~<iframe src="//www.youtube.com/embed/deby_Yb1-ac?" frameborder="0" width="425" height="350" allowfullscreen=""></iframe>~/np~', ['movie' => 'https://youtu.be/deby_Yb1-ac']], 27 ['', '~np~<iframe src="//www.youtube-nocookie.com/embed/deby_Yb1-ac?" frameborder="0" width="425" height="350" allowfullscreen=""></iframe>~/np~', ['movie' => 'https://youtu.be/deby_Yb1-ac', 'privacyEnhanced' => 'y']], 28 ]; 29 } 30} 31