boo

'; $expected = '

boo

'; $this->assertEquals($expected, Filter::stripHeadTags($input)); $input = file_get_contents('tests/fixtures/html4_page.html'); $expected = file_get_contents('tests/fixtures/html4_head_stripped_page.html'); $this->assertEquals($expected, Filter::stripHeadTags($input)); $input = file_get_contents('tests/fixtures/html_page.html'); $expected = file_get_contents('tests/fixtures/html_head_stripped_page.html'); $this->assertEquals($expected, Filter::stripHeadTags($input)); } public function testStripXmlTag() { $data = file_get_contents('tests/fixtures/jeux-linux.fr.xml'); $this->assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('assertEquals('attribute->setIframeWhitelist(array('http://www.kickstarter.com')); $this->assertEquals($expected, $f->execute()); $data = ''; $f = Filter::html($data, 'http://blabla'); $f->attribute->setIframeWhitelist(array('http://www.kickstarter.com')); $this->assertEmpty($f->execute()); $config = new Config; $config->setFilterWhitelistedTags(array('p' => array('title'))); $f = Filter::html('

Testboo

', 'http://blabla'); $f->setConfig($config); $this->assertEquals('

Testboo

', $f->execute()); } public function testNoImageProxySet() { $f = Filter::html('

Image My Image

', 'http://foo'); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testImageProxyWithHTTPLink() { $config = new Config; $config->setFilterImageProxyUrl('http://myproxy/?url=%s'); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testImageProxyWithHTTPSLink() { $config = new Config; $config->setFilterImageProxyUrl('http://myproxy/?url=%s'); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testImageProxyLimitedToUnknownProtocol() { $config = new Config; $config->setFilterImageProxyUrl('http://myproxy/?url=%s'); $config->setFilterImageProxyProtocol('tripleX'); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testImageProxyLimitedToHTTPwithHTTPLink() { $config = new Config; $config->setFilterImageProxyUrl('http://myproxy/?url=%s'); $config->setFilterImageProxyProtocol('http'); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testImageProxyLimitedToHTTPwithHTTPSLink() { $config = new Config; $config->setFilterImageProxyUrl('http://myproxy/?url=%s'); $config->setFilterImageProxyProtocol('http'); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testImageProxyLimitedToHTTPSwithHTTPLink() { $config = new Config; $config->setFilterImageProxyUrl('http://myproxy/?url=%s'); $config->setFilterImageProxyProtocol('https'); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testImageProxyLimitedToHTTPSwithHTTPSLink() { $config = new Config; $config->setFilterImageProxyUrl('http://myproxy/?url=%s'); $config->setFilterImageProxyProtocol('https'); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } public function testsetFilterImageProxyCallback() { $config = new Config; $config->setFilterImageProxyCallback(function ($image_url) { $key = hash_hmac('sha1', $image_url, 'secret'); return 'https://mypublicproxy/'.$key.'/'.rawurlencode($image_url); }); $f = Filter::html('

Image My Image

', 'http://foo'); $f->setConfig($config); $this->assertEquals( '

Image My Image

', $f->execute() ); } }