Änderungen https Andy Müller rückgängig gemacht
This commit is contained in:
@ -12,8 +12,8 @@ class HTMLPurifier_Injector_DisplayLinkURITest extends HTMLPurifier_InjectorHarn
|
||||
public function testBasicLink()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="https://malware.example.com">Don\'t go here!</a>',
|
||||
'<a>Don\'t go here!</a> (https://malware.example.com)'
|
||||
'<a href="http://malware.example.com">Don\'t go here!</a>',
|
||||
'<a>Don\'t go here!</a> (http://malware.example.com)'
|
||||
);
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@ class HTMLPurifier_Injector_DisplayLinkURITest extends HTMLPurifier_InjectorHarn
|
||||
public function testEmptyText()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="https://malware.example.com"></a>',
|
||||
'<a></a> (https://malware.example.com)'
|
||||
'<a href="http://malware.example.com"></a>',
|
||||
'<a></a> (http://malware.example.com)'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -12,31 +12,31 @@ class HTMLPurifier_Injector_LinkifyTest extends HTMLPurifier_InjectorHarness
|
||||
public function testLinkifyURLInRootNode()
|
||||
{
|
||||
$this->assertResult(
|
||||
'https://example.com',
|
||||
'<a href="https://example.com">https://example.com</a>'
|
||||
'http://example.com',
|
||||
'<a href="http://example.com">http://example.com</a>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testLinkifyURLInInlineNode()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<b>https://example.com</b>',
|
||||
'<b><a href="https://example.com">https://example.com</a></b>'
|
||||
'<b>http://example.com</b>',
|
||||
'<b><a href="http://example.com">http://example.com</a></b>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testBasicUsageCase()
|
||||
{
|
||||
$this->assertResult(
|
||||
'This URL https://example.com is what you need',
|
||||
'This URL <a href="https://example.com">https://example.com</a> is what you need'
|
||||
'This URL http://example.com is what you need',
|
||||
'This URL <a href="http://example.com">http://example.com</a> is what you need'
|
||||
);
|
||||
}
|
||||
|
||||
public function testIgnoreURLInATag()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a>https://example.com/</a>'
|
||||
'<a>http://example.com/</a>'
|
||||
);
|
||||
}
|
||||
|
||||
@ -44,20 +44,20 @@ class HTMLPurifier_Injector_LinkifyTest extends HTMLPurifier_InjectorHarness
|
||||
{
|
||||
$this->config->set('HTML.Allowed', 'b');
|
||||
$this->expectError('Cannot enable Linkify injector because a is not allowed');
|
||||
$this->assertResult('https://example.com/');
|
||||
$this->assertResult('http://example.com/');
|
||||
}
|
||||
|
||||
public function testExcludes()
|
||||
{
|
||||
$this->assertResult('<a><span>https://example.com</span></a>');
|
||||
$this->assertResult('<a><span>http://example.com</span></a>');
|
||||
}
|
||||
|
||||
public function testRegexIsSmart()
|
||||
{
|
||||
$this->assertResult('https://example.com/foo.', '<a href="https://example.com/foo">https://example.com/foo</a>.');
|
||||
$this->assertResult('“https://example.com/foo”', '“<a href="https://example.com/foo">https://example.com/foo</a>”');
|
||||
$this->assertResult('“https://example.com”', '“<a href="https://example.com">https://example.com</a>”');
|
||||
$this->assertResult('(https://example.com/f(o)o)', '(<a href="https://example.com/f(o)o">https://example.com/f(o)o</a>)');
|
||||
$this->assertResult('http://example.com/foo.', '<a href="http://example.com/foo">http://example.com/foo</a>.');
|
||||
$this->assertResult('“http://example.com/foo”', '“<a href="http://example.com/foo">http://example.com/foo</a>”');
|
||||
$this->assertResult('“http://example.com”', '“<a href="http://example.com">http://example.com</a>”');
|
||||
$this->assertResult('(http://example.com/f(o)o)', '(<a href="http://example.com/f(o)o">http://example.com/f(o)o</a>)');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -105,14 +105,14 @@ class HTMLPurifier_Injector_RemoveEmptyTest extends HTMLPurifier_InjectorHarness
|
||||
public function testNoRemoveIframe()
|
||||
{
|
||||
$this->config->set('HTML.SafeIframe', true);
|
||||
$this->assertResult('<iframe src="https://google.com"></iframe>', '');
|
||||
$this->assertResult('<iframe src="http://google.com"></iframe>', '');
|
||||
}
|
||||
|
||||
public function testRemoveDisallowedIframe()
|
||||
{
|
||||
$this->config->set('HTML.SafeIframe', true);
|
||||
$this->config->set('URI.SafeIframeRegexp', '%^https://www.youtube.com/embed/%');
|
||||
$this->assertResult('<iframe src="https://google.com"></iframe>', '');
|
||||
$this->config->set('URI.SafeIframeRegexp', '%^http://www.youtube.com/embed/%');
|
||||
$this->assertResult('<iframe src="http://google.com"></iframe>', '');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user