@@ -927,5 +927,31 @@ public function testHReviewRelTag() {
927927 $ this ->assertContains ('Garcon ' , $ output ['items ' ][0 ]['properties ' ]['category ' ]);
928928 $ this ->assertContains ('Garçon ' , $ output ['items ' ][0 ]['properties ' ]['category ' ]);
929929 }
930+
931+ /**
932+ * Should return the last non-empty URL segment
933+ * @see https://github.com/indieweb/php-mf2/issues/157
934+ */
935+ public function testRelTagTrailingSlash () {
936+ $ input = '<div class="hentry">
937+ <a rel="tag" href="/tags/testing/">Testing</a>,
938+ <a rel="tag" href="/tags/microformats">Microformats</a>
939+ </div>
940+
941+ <div class="hreview">
942+ <a rel="tag" href="/tags/phpmf2/">php-mf2</a>,
943+ <a rel="tag" href="/tags/mf2py">mf2py</a>
944+ </div>
945+ ' ;
946+ $ parser = new Parser ($ input );
947+ $ output = $ parser ->parse ();
948+
949+ $ this ->assertArrayHasKey ('category ' , $ output ['items ' ][0 ]['properties ' ]);
950+ $ this ->assertContains ('testing ' , $ output ['items ' ][0 ]['properties ' ]['category ' ]);
951+ $ this ->assertContains ('microformats ' , $ output ['items ' ][0 ]['properties ' ]['category ' ]);
952+ $ this ->assertArrayHasKey ('category ' , $ output ['items ' ][1 ]['properties ' ]);
953+ $ this ->assertContains ('phpmf2 ' , $ output ['items ' ][1 ]['properties ' ]['category ' ]);
954+ $ this ->assertContains ('mf2py ' , $ output ['items ' ][1 ]['properties ' ]['category ' ]);
955+ }
930956}
931957
0 commit comments