@@ -171,4 +171,71 @@ public function test_vevent() {
171
171
$ this ->assertEquals ('1998-03-12T09:30 ' , $ output ['items ' ][0 ]['properties ' ]['end ' ][0 ]);
172
172
}
173
173
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">Jumping Rope for Weight Loss</span>
195
+ <div class="entry-content">Some Content</div>
196
+ <a rel="bookmark" href="/2014/11/24/jump-rope">Nov 24, 2014</a>
197
+ </article>
198
+
199
+ <article class="hentry">
200
+ <span class="author">Kara Thrace</span>
201
+ <span class="entry-title">Abstract Art in Graffiti</span>
202
+ <div class="entry-content">More Content</div>
203
+ <a rel="bookmark" href="/2014/11/23/graffiti">Nov 23, 2014</a>
204
+ </article>
205
+
206
+ <article class="hentry">
207
+ <span class="author">President Roslyn</span>
208
+ <span class="entry-title">Dreams of Earth</span>
209
+ <div class="entry-content">Additional Content</div>
210
+ <a rel="bookmark" href="/2014/11/21/earth">Nov 21, 2014</a>
211
+ </article>
212
+
213
+ <article class="hentry">
214
+ <span class="author">Chief Tyrrol</span>
215
+ <span class="entry-title">Organized Labor in Mining Colonies</span>
216
+ <div class="entry-content">More Content</div>
217
+ <a rel="bookmark" href="/2014/11/19/labor">Nov 19, 2014</a>
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
+
174
241
}
0 commit comments