Exemplo n.º 1
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\SoundCloud::registerExtensionProcessing
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('soundcloud');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('soundcloud'));
     $expected = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/80365438&amp;color=ff5500&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false"></iframe>';
     $in = '[soundcloud url="https://api.soundcloud.com/tracks/80365438" params="color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false" width="100%" height="166" iframe="true" /]';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 2
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\Iframe::registerExtensionProcessing
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('iframe');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('iframe'));
     $expected = '<iframe src="url"';
     $in = '[iframe=300,200]url[/iframe]';
     $actual = trim($this->sanitizer->filterForDisplay($in));
     $this->assertTrue(is_string($actual));
     $this->assertEquals($expected, substr($actual, 0, strlen($expected)));
 }
Exemplo n.º 3
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\UnorderedList::registerExtensionProcessing
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('unorderedlist');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('ul'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('li'));
     $in = '[ul][li]item[/li][/ul]';
     $expected = '<ul><li>item</li></ul>';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 4
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\YouTube::registerExtensionProcessing
  * @todo   Implement testRegisterExtensionProcessing().
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('youtube');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('youtube'));
     $expected = '<iframe width="180" height="100" src="https://www.youtube.com/embed/12345678901" frameborder="0" allowfullscreen></iframe>';
     $in = '[youtube=180,100]12345678901[/youtube]';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
     $in = '[youtube url="12345678901" width="180" height=100 /]';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 5
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\Mp3::registerExtensionProcessing
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('mp3');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('mp3'));
     $expected = '<audio controls><source src="http://spot.river-styx.com/media/spot6.mp3" type="audio/mpeg"></audio>';
     $in = '[mp3]http://spot.river-styx.com/media/spot6.mp3[/mp3]';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
     $in = '[mp3 url="http://spot.river-styx.com/media/spot6.mp3" /]';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 6
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\Image::registerExtensionProcessing
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('image');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('img'));
     $this->markTestSkipped('invokes Xoops::theme() provoking multiple failure on a real system');
     $in = '[img]url[/img]';
     $expected = trim($this->sanitizer->filterForDisplay($in));
     $this->assertTrue(is_string($expected));
     $in = '[img url="url" /]';
     $actual = trim($this->sanitizer->filterForDisplay($in));
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 7
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\Flash::registerExtensionProcessing
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('flash');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('flash'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('swf'));
     $expected = '<object type="application/x-shockwave-flash" data="http://spot.river-styx.com/media/hello.swf" width="300" height="200"></object>';
     $in = '[flash=300,200]http://spot.river-styx.com/media/hello.swf[/flash]';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
     $in = '[flash url="http://spot.river-styx.com/media/hello.swf" width="300" height=200 /]';
     $actual = $this->sanitizer->filterForDisplay($in);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 8
0
 /**
  * @covers Xoops\Core\Text\Sanitizer\Extensions\XoopsCode::registerExtensionProcessing
  * @todo   Implement testRegisterExtensionProcessing().
  */
 public function testRegisterExtensionProcessing()
 {
     $this->sanitizer->enableComponentForTesting('xoopscode');
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('siteurl'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('url'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('color'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('size'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('font'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('email'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('b'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('i'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('u'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('d'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('center'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('left'));
     $this->assertTrue($this->sanitizer->getShortCodes()->hasShortcode('right'));
 }