|
@@ -6,6 +6,7 @@
|
6
|
6
|
td, th { border: 1px solid #000; padding: 10px; }
|
7
|
7
|
td.error { text-align: center; color: #fff; background-color: #c00; }
|
8
|
8
|
td.succ { text-align: center; color: #fff; background-color: #0c0; }
|
|
9
|
+ var { font-size: small; color: purple; font-style: normal; padding: 0 2px; }
|
9
|
10
|
</style>
|
10
|
11
|
</head>
|
11
|
12
|
<body>
|
|
@@ -17,16 +18,18 @@
|
17
|
18
|
|
18
|
19
|
require_once('../discoverer.inc.php');
|
19
|
20
|
|
|
21
|
+ define('BASE_URI', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/');
|
|
22
|
+
|
20
|
23
|
function doHtmlTest($output, $input) {
|
21
|
24
|
|
22
|
|
- $disc = new Discoverer(null);
|
23
|
|
- $disc->parseHtml(file_get_contents($input));
|
24
|
|
- $aoutput = $disc->getVersion() . ':' . $disc->getEndpointUrl() . ',' . $disc->getOpLocalId();
|
|
25
|
+ $disc = new Discoverer(BASE_URI . $input);
|
|
26
|
+ $aoutput = $disc->getVersion() . "\n" . $disc->getEndpointUrl() . "\n" . $disc->getUserSuppliedId() . "\n" . $disc->getClaimedId() . "\n" . $disc->getOpLocalId();
|
|
27
|
+ $aoutput = str_replace(BASE_URI, '%URL%', $aoutput);
|
25
|
28
|
$result = $aoutput == $output;
|
26
|
29
|
|
27
|
30
|
echo '<tr><td><a href="', htmlentities($input), '">', htmlentities($input), '</a></td>';
|
28
|
|
- echo '<td>', htmlentities($output), '</td>';
|
29
|
|
- echo '<td>', htmlentities($aoutput), '</td>';
|
|
31
|
+ echo '<td>', str_replace('%URL%', '<var>%URL%</var>', nl2br(htmlentities($output))), '</td>';
|
|
32
|
+ echo '<td>', str_replace('%URL%', '<var>%URL%</var>', nl2br(htmlentities($aoutput))), '</td>';
|
30
|
33
|
echo '<td class="', $result ? 'succ' : 'error', '">';
|
31
|
34
|
echo $result ? 'Passed' : 'Failed';
|
32
|
35
|
echo '</td>';
|
|
@@ -34,14 +37,14 @@
|
34
|
37
|
}
|
35
|
38
|
|
36
|
39
|
$tests = array(
|
37
|
|
- 'samplehtml/test1.html' => '1:http://server.com/path,http://delegate.com/',
|
38
|
|
- 'samplehtml/test2.html' => '1:http://server.com/path,http://delegate.com/',
|
39
|
|
- 'samplehtml/test3.html' => '1:http://server/path?foo&bar,',
|
40
|
|
- 'samplehtml/v2-test1.html' => '2:http://server.com/path,http://delegate.com/',
|
41
|
|
- 'samplehtml/v2-test2.html' => '2:http://server.com/path,',
|
42
|
|
- 'samplehtml/v2-test3.html' => '2:http://server.com/path,',
|
43
|
|
- 'samplehtml/v2-test4.html' => '1:http://server.com/path,http://delegate.com/',
|
44
|
|
- 'samplehtml/v2-test5.html' => '1:http://server.com/path,http://delegate.com/',
|
|
40
|
+ 'samplehtml/test1.html' => "1\nhttp://server.com/path\n%URL%samplehtml/test1.html\n%URL%samplehtml/test1.html\nhttp://delegate.com/",
|
|
41
|
+ 'samplehtml/test2.html' => "1\nhttp://server.com/path\n%URL%samplehtml/test2.html\n%URL%samplehtml/test2.html\nhttp://delegate.com/",
|
|
42
|
+ 'samplehtml/test3.html' => "1\nhttp://server/path?foo&bar\n%URL%samplehtml/test3.html\n%URL%samplehtml/test3.html\n",
|
|
43
|
+ 'samplehtml/v2-test1.html' => "2\nhttp://server.com/path\n%URL%samplehtml/v2-test1.html\n%URL%samplehtml/v2-test1.html\nhttp://delegate.com/",
|
|
44
|
+ 'samplehtml/v2-test2.html' => "2\nhttp://server.com/path\n%URL%samplehtml/v2-test2.html\n%URL%samplehtml/v2-test2.html\n%URL%samplehtml/v2-test2.html",
|
|
45
|
+ 'samplehtml/v2-test3.html' => "2\nhttp://server.com/path\n%URL%samplehtml/v2-test3.html\n%URL%samplehtml/v2-test3.html\n%URL%samplehtml/v2-test3.html",
|
|
46
|
+ 'samplehtml/v2-test4.html' => "1\nhttp://server.com/path\n%URL%samplehtml/v2-test4.html\n%URL%samplehtml/v2-test4.html\nhttp://delegate.com/",
|
|
47
|
+ 'samplehtml/v2-test5.html' => "1\nhttp://server.com/path\n%URL%samplehtml/v2-test5.html\n%URL%samplehtml/v2-test5.html\nhttp://delegate.com/",
|
45
|
48
|
);
|
46
|
49
|
|
47
|
50
|
array_walk($tests, 'doHtmlTest');
|