@@ -41,6 +41,51 @@ public function testRelValueOnAreaTag() {
4141 $ this ->assertEquals ('http://example.com/webmention ' , $ output ['rels ' ]['webmention ' ][0 ]);
4242 }
4343
44+ public function testRelValueOrder () {
45+ $ input = '<map><area rel="webmention" href="http://example.com/area"/></map>
46+ <a rel="webmention" href="http://example.com/a">webmention me</a>
47+ <link rel="webmention" href="http://example.com/link"> ' ;
48+ $ parser = new Parser ($ input );
49+ $ output = $ parser ->parse ();
50+
51+ $ this ->assertArrayHasKey ('webmention ' , $ output ['rels ' ]);
52+ $ this ->assertEquals ('http://example.com/area ' , $ output ['rels ' ]['webmention ' ][0 ]);
53+ $ this ->assertEquals ('http://example.com/a ' , $ output ['rels ' ]['webmention ' ][1 ]);
54+ $ this ->assertEquals ('http://example.com/link ' , $ output ['rels ' ]['webmention ' ][2 ]);
55+ }
56+
57+ public function testRelValueOrder2 () {
58+ $ input = '<map><area rel="webmention" href="http://example.com/area"/></map>
59+ <link rel="webmention" href="http://example.com/link">
60+ <a rel="webmention" href="http://example.com/a">webmention me</a> ' ;
61+ $ parser = new Parser ($ input );
62+ $ output = $ parser ->parse ();
63+
64+ $ this ->assertArrayHasKey ('webmention ' , $ output ['rels ' ]);
65+ $ this ->assertEquals ('http://example.com/area ' , $ output ['rels ' ]['webmention ' ][0 ]);
66+ $ this ->assertEquals ('http://example.com/link ' , $ output ['rels ' ]['webmention ' ][1 ]);
67+ $ this ->assertEquals ('http://example.com/a ' , $ output ['rels ' ]['webmention ' ][2 ]);
68+ }
69+
70+ public function testRelValueOrder3 () {
71+ $ input = '<html>
72+ <head>
73+ <link rel="webmention" href="http://example.com/link">
74+ </head>
75+ <body>
76+ <a rel="webmention" href="http://example.com/a">webmention me</a>
77+ <map><area rel="webmention" href="http://example.com/area"/></map>
78+ </body>
79+ </html> ' ;
80+ $ parser = new Parser ($ input );
81+ $ output = $ parser ->parse ();
82+
83+ $ this ->assertArrayHasKey ('webmention ' , $ output ['rels ' ]);
84+ $ this ->assertEquals ('http://example.com/link ' , $ output ['rels ' ]['webmention ' ][0 ]);
85+ $ this ->assertEquals ('http://example.com/a ' , $ output ['rels ' ]['webmention ' ][1 ]);
86+ $ this ->assertEquals ('http://example.com/area ' , $ output ['rels ' ]['webmention ' ][2 ]);
87+ }
88+
4489 public function testRelValueOnBTag () {
4590 $ input = '<b rel="webmention" href="http://example.com/webmention">this makes no sense</b> ' ;
4691 $ parser = new Parser ($ input );
0 commit comments