2
0
mirror of https://github.com/boostorg/website.git synced 2026-02-13 13:02:10 +00:00
Files
website/common/code/test/tests/boost_site_tools-link.phpt
Daniel James 75000f5de7 Move tests into subdirectory.
To avoid running all the vendor tests on Travis.
2016-06-02 09:04:44 +01:00

52 lines
1.5 KiB
PHP

<?php
use Tester\Assert;
require_once(__DIR__.'/../config/bootstrap.php');
require_once(__DIR__.'/../../boost.php');
# Some of these tests have other correct values.
# e.g. might quote attributes values differently.
# Relative link
Assert::same(
'<a href="http://www.boost.org/a/b/c.txt">',
BoostSiteTools::base_links(
'<a href="../b/c.txt">',
'http://www.boost.org/a/d/e.html'));
# Absolute link
Assert::same(
'<A hReF="http://svn.boost.org/trac/wiki">',
BoostSiteTools::base_links(
'<A hReF="http://svn.boost.org/trac/wiki">',
'http://www.boost.org/a/d/e.html'));
# Root link
Assert::same(
'<img class=something src="http://www.boost.org/logo.png">',
BoostSiteTools::base_links(
'<img class=something src="/logo.png">',
'http://www.boost.org/a/d/e.html'));
# Unquoted
Assert::same(
'<img src="http://www.boost.org/logo.png">',
BoostSiteTools::base_links(
'<img src=/logo.png>',
'http://www.boost.org/a/d/e.html'));
# Encoding quotes
Assert::same(
'<img src="http://www.boost.org/&quot;logo.png&quot;">',
BoostSiteTools::base_links(
'<img src=\'/"logo.png"\'>',
'http://www.boost.org/a/d/e.html'));
# Don't match quoted text in tags, but do out of tags.
Assert::same(
'<p blah="<img src=/logo.png>">"<img src="http://www.boost.org/logo.png">"',
BoostSiteTools::base_links(
'<p blah="<img src=/logo.png>">"<img src=/logo.png>"',
'http://www.boost.org/a/d/e.html'));