@@ -171,4 +171,71 @@ public function test_vevent() {
171171 $ this ->assertEquals ('1998-03-12T09:30 ' , $ output ['items ' ][0 ]['properties ' ]['end ' ][0 ]);
172172 }
173173
174+
175+ /**
176+ * @see https://github.com/indieweb/php-mf2/issues/57
177+ * @see https://github.com/kartikprabhu/mf2py/pull/50/
178+ */
179+ public function testRelBookmarkUrl () {
180+ $ input = <<< END
181+ <!DOCTYPE html>
182+ <html>
183+ <head>
184+ <title>Backcompat test for hEntry with nested rel=bookmark</title>
185+ <!-- This should not affect parsing elsewhere -->
186+ <link rel="bookmark" href="/about">
187+ </head>
188+ <body>
189+ <!-- This should not affect parsing elsewhere -->
190+ <a rel="bookmark" href="/"></a>
191+
192+ <article class="hentry">
193+ <span class="author">Lee Adama</span>
194+ <span class="entry-title"><a rel="bookmark" class="something" href="/2014/11/24/jump-rope">Jumping Rope for Weight Loss</a></span>
195+ <div class="entry-content">Some Content</div>
196+ Nov 24, 2014
197+ </article>
198+
199+ <article class="hentry">
200+ <span class="author">Kara Thrace</span>
201+ <span class="entry-title"><a rel="bookmark" class="" href="/2014/11/23/graffiti">Abstract Art in Graffiti</a></span>
202+ <div class="entry-content">More Content</div>
203+ Nov 23, 2014
204+ </article>
205+
206+ <article class="hentry">
207+ <span class="author">President Roslyn</span>
208+ <span class="entry-title"><a rel="something bookmark" href="/2014/11/21/earth">Dreams of Earth</a></span>
209+ <div class="entry-content">Additional Content</div>
210+ Nov 21, 2014
211+ </article>
212+
213+ <article class="hentry">
214+ <span class="author">Chief Tyrrol</span>
215+ <span class="entry-title"><a rel="something bookmark somethingelse" class="somethingelse" href="/2014/11/19/labor">Organized Labor in Mining Colonies</a></span>
216+ <div class="entry-content">More Content</div>
217+ Nov 19, 2014
218+ </article>
219+
220+ </body>
221+ </html>
222+ END ;
223+ $ output = Mf2 \parse ($ input );
224+
225+ $ u_urls = array (
226+ '/2014/11/24/jump-rope ' ,
227+ '/2014/11/23/graffiti ' ,
228+ '/2014/11/21/earth ' ,
229+ '/2014/11/19/labor ' ,
230+ );
231+
232+ foreach ( $ u_urls as $ key => $ url )
233+ {
234+ $ this ->assertEquals ('h-entry ' , $ output ['items ' ][$ key ]['type ' ][0 ]);
235+ $ this ->assertArrayHasKey ('url ' , $ output ['items ' ][$ key ]['properties ' ]);
236+ $ this ->assertEquals ($ url , $ output ['items ' ][$ key ]['properties ' ]['url ' ][0 ]);
237+ }
238+
239+ }
240+
174241}
0 commit comments