diff options
author | alecpl <alec@alec.pl> | 2011-04-29 08:17:42 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-04-29 08:17:42 +0000 |
commit | c08b18c4b92cc7c253c72709e3aecb639a742d9f (patch) | |
tree | c02837a76a99f32b249eae166a68e459f753f694 /tests | |
parent | 09b0e36b3f453a410b3389b6d95a29605d13bfca (diff) |
- Fix relative URLs handling according to a <base> in HTML (#1487889)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mailfunc.php | 12 | ||||
-rw-r--r-- | tests/src/htmlbase.txt | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/mailfunc.php b/tests/mailfunc.php index 92cfbb100..9d70befeb 100644 --- a/tests/mailfunc.php +++ b/tests/mailfunc.php @@ -145,4 +145,16 @@ class rcube_test_mailfunc extends UnitTestCase $this->assertNoPattern('|<p>test2</p>|', $washed, "Conditional HTML comments"); } + /** + * Test URI base resolving in HTML messages + */ + function test_resolve_base() + { + $html = file_get_contents(TESTS_DIR . 'src/htmlbase.txt'); + $html = rcmail_resolve_base($html); + + $this->assertPattern('|src="http://alec\.pl/dir/img1\.gif"|', $html, "URI base resolving [1]"); + $this->assertPattern('|src="http://alec\.pl/dir/img2\.gif"|', $html, "URI base resolving [2]"); + $this->assertPattern('|src="http://alec\.pl/img3\.gif"|', $html, "URI base resolving [3]"); + } } diff --git a/tests/src/htmlbase.txt b/tests/src/htmlbase.txt new file mode 100644 index 000000000..d1ddd5406 --- /dev/null +++ b/tests/src/htmlbase.txt @@ -0,0 +1,10 @@ +<html> +<head> +<base href="http://alec.pl/dir/" /> +</head> +<body> +<img src="img1.gif" /> +<img src="./img2.gif" /> +<img src="../img3.gif" /> +</body> +</html> |