Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
Use Powell's for Portland since Geoloqi no longer exists.
Standardized some example.org links to example.com.
Use https:// for example.com and microformats.org URLs.
Updated indiewebcamp.com to indieweb.org.

Some exceptions to the above are tests where the HTML was not
contrived but came from a published website.
  • Loading branch information
gRegorLove committed Mar 9, 2024
1 parent 103b34e commit cff0bef
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 218 deletions.
16 changes: 8 additions & 8 deletions tests/Mf2/ClassicMicroformatsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* Contains tests of the classic microformat => µf2 functionality.
*
* Mainly based off BC tables on http://microformats.org/wiki/microformats2#v2_vocabularies
* Mainly based off BC tables on https://microformats.org/wiki/microformats2#v2_vocabularies
*/
class ClassicMicroformatsTest extends TestCase {
protected function set_up() {
Expand Down Expand Up @@ -152,7 +152,7 @@ public function test_vevent() {
<div class="vevent">
<h3 class="summary">XYZ Project Review</h3>
<p class="description">Project XYZ Review Meeting</p>
<p> <a class="url" href="http://example.com/xyz-meeting">http://example.com/xyz-meeting</a> </p>
<p> <a class="url" href="https://example.com/xyz-meeting">https://example.com/xyz-meeting</a> </p>
<p>To be held on
<span class="dtstart">
<abbr class="value" title="1998-03-12">the 12th of March</abbr>
Expand Down Expand Up @@ -181,7 +181,7 @@ public function test_vevent() {

$this->assertEquals('XYZ Project Review', $output['items'][0]['properties']['name'][0]);
$this->assertEquals('Project XYZ Review Meeting', $output['items'][0]['properties']['description'][0]);
$this->assertEquals('http://example.com/xyz-meeting', $output['items'][0]['properties']['url'][0]);
$this->assertEquals('https://example.com/xyz-meeting', $output['items'][0]['properties']['url'][0]);
$this->assertEquals('1998-03-12 08:30-0500', $output['items'][0]['properties']['start'][0]);
$this->assertEquals('1998-03-12 09:30-0500', $output['items'][0]['properties']['end'][0]);
}
Expand Down Expand Up @@ -255,7 +255,7 @@ public function testRelBookmarkUrl() {


/**
* @see http://microformats.org/wiki/microformats2-parsing-issues#any_h-_root_class_name_overrides_and_stops_backcompat_root
* @see https://microformats.org/wiki/microformats2-parsing-issues#any_h-_root_class_name_overrides_and_stops_backcompat_root
*/
public function testMf2RootStopsBackcompatRoot() {
$input = '<div class="adr h-adr">
Expand All @@ -273,7 +273,7 @@ public function testMf2RootStopsBackcompatRoot() {


/**
* @see http://microformats.org/wiki/microformats2-parsing-issues#any_h-_root_class_name_overrides_and_stops_backcompat_root
* @see https://microformats.org/wiki/microformats2-parsing-issues#any_h-_root_class_name_overrides_and_stops_backcompat_root
*/
public function testMf2CustomRootStopsBackcompatRoot() {
$input = '<div class="adr h-acme-address">
Expand All @@ -291,7 +291,7 @@ public function testMf2CustomRootStopsBackcompatRoot() {


/**
* @see http://microformats.org/wiki/microformats2-parsing-issues#uf2_children_on_backcompat_properties
* @see https://microformats.org/wiki/microformats2-parsing-issues#uf2_children_on_backcompat_properties
*/
public function testMf2ChildrenOnBackcompatProperties() {
$input = '<div class="vcard">
Expand Down Expand Up @@ -753,7 +753,7 @@ public function testMixedMf2andMf1Case4() {


/**
* @see http://microformats.org/wiki/hReview#Examples
* @see https://microformats.org/wiki/hReview#Examples
*/
public function testParsesClassicHreview() {
$input = <<< END
Expand All @@ -767,7 +767,7 @@ public function testParsesClassicHreview() {
</div>
<p>Visit date: <span>April 2005</span></p>
<p>Food eaten: <span>Florentine crepe</span></p>
<p>Permanent link for review: <a rel="self bookmark" href="http://example.com/crepe">http://example.com/crepe</a></p>
<p>Permanent link for review: <a rel="self bookmark" href="https://example.com/crepe">https://example.com/crepe</a></p>
</div>
END;
$parser = new Parser($input);
Expand Down
48 changes: 25 additions & 23 deletions tests/Mf2/CombinedMicroformatsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Combined Microformats Test
*
* Tests the ability of Parser::parse() to handle nested microformats correctly.
* More info at http://microformats.org/wiki/microformats-2#combining_microformats
* More info at https://microformats.org/wiki/microformats-2#combining_microformats
*
* @todo implement
*/
Expand All @@ -23,18 +23,20 @@ protected function set_up() {
}

/**
* From http://microformats.org/wiki/microformats2#combining_microformats
* From https://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHEventLocationHCard() {
// Note: The venue for IWC 2012 no longer exists so we switched
// this to Powell's since it's a long-term Portland institution
$input = '<div class="h-event">
<a class="p-name u-url" href="http://indiewebcamp.com/2012">
<a class="p-name u-url" href="https://indieweb.org/2012">
IndieWebCamp 2012
</a>
from <time class="dt-start">2012-06-30</time>
to <time class="dt-end">2012-07-01</time> at
<span class="p-location h-card">
<a class="p-name p-org u-url" href="http://geoloqi.com/">
Geoloqi</a>, <span class="p-street-address">920 SW 3rd Ave. Suite 400</span>, <span class="p-locality">Portland</span>, <abbr class="p-region" title="Oregon">OR</abbr>
<a class="p-name p-org u-url" href="https://www.powells.com/">
Powell’s</a>, <span class="p-street-address">1005 W Burnside St.</span>, <span class="p-locality">Portland</span>, <abbr class="p-region" title="Oregon">OR</abbr>
</span>
</div>';
$expected = '{
Expand All @@ -44,17 +46,17 @@ public function testHEventLocationHCard() {
"type": ["h-event"],
"properties": {
"name": ["IndieWebCamp 2012"],
"url": ["http://indiewebcamp.com/2012"],
"url": ["https://indieweb.org/2012"],
"start": ["2012-06-30"],
"end": ["2012-07-01"],
"location": [{
"value": "Geoloqi",
"value": "Powell’s",
"type": ["h-card"],
"properties": {
"name": ["Geoloqi"],
"org": ["Geoloqi"],
"url": ["http://geoloqi.com/"],
"street-address": ["920 SW 3rd Ave. Suite 400"],
"name": ["Powell’s"],
"org": ["Powell’s"],
"url": ["https://www.powells.com/"],
"street-address": ["1005 W Burnside St."],
"locality": ["Portland"],
"region": ["Oregon"]
}
Expand All @@ -71,7 +73,7 @@ public function testHEventLocationHCard() {
}

/**
* From http://microformats.org/wiki/microformats2#combining_microformats
* From https://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardOrgPOrg() {
$input = '<div class="h-card">
Expand Down Expand Up @@ -101,7 +103,7 @@ public function testHCardOrgPOrg() {
}

/**
* From http://microformats.org/wiki/microformats2#combining_microformats
* From https://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardOrgHCard() {
$input = '<div class="h-card">
Expand Down Expand Up @@ -140,7 +142,7 @@ public function testHCardOrgHCard() {
}

/**
* From http://microformats.org/wiki/microformats2#combining_microformats
* From https://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardPOrgHCardHOrg() {
$input = '<div class="h-card">
Expand Down Expand Up @@ -178,7 +180,7 @@ public function testHCardPOrgHCardHOrg() {
}

/**
* From http://microformats.org/wiki/microformats2#combining_microformats
* From https://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardChildHCard() {
$input = '<div class="h-card">
Expand Down Expand Up @@ -257,9 +259,9 @@ public function testMicroformatsNestedUnderUPropertyClassnamesDeriveValueFromURL
<p class="e-content">Hello World</p>
<ul>
<li class="u-comment h-cite">
<a class="u-author h-card" href="http://jane.example.com/">Jane Bloggs</a>
<a class="u-author h-card" href="https://jane.example.com/">Jane Bloggs</a>
<p class="p-content p-name">lol</p>
<a class="u-url" href="http://example.org/post1234"><time class="dt-published">2015-07-12 12:03</time></a>
<a class="u-url" href="https://example.com/post1234"><time class="dt-published">2015-07-12 12:03</time></a>
</li>
</ul>
</div>';
Expand All @@ -279,16 +281,16 @@ public function testMicroformatsNestedUnderUPropertyClassnamesDeriveValueFromURL
"type": ["h-card"],
"properties": {
"name": ["Jane Bloggs"],
"url": ["http:\/\/jane.example.com\/"]
"url": ["https:\/\/jane.example.com\/"]
},
"value": "http:\/\/jane.example.com\/"
"value": "https:\/\/jane.example.com\/"
}],
"content": ["lol"],
"name": ["lol"],
"url": ["http:\/\/example.org\/post1234"],
"url": ["https:\/\/example.com\/post1234"],
"published": ["2015-07-12 12:03"]
},
"value": "http:\/\/example.org\/post1234"
"value": "https:\/\/example.com\/post1234"
}]
}
}],
Expand All @@ -298,8 +300,8 @@ public function testMicroformatsNestedUnderUPropertyClassnamesDeriveValueFromURL
$mf = Mf2\parse($input);

$this->assertJsonStringEqualsJsonString(json_encode($mf), $expected);
$this->assertEquals($mf['items'][0]['properties']['comment'][0]['value'], 'http://example.org/post1234');
$this->assertEquals($mf['items'][0]['properties']['comment'][0]['properties']['author'][0]['value'], 'http://jane.example.com/');
$this->assertEquals($mf['items'][0]['properties']['comment'][0]['value'], 'https://example.com/post1234');
$this->assertEquals($mf['items'][0]['properties']['comment'][0]['properties']['author'][0]['value'], 'https://jane.example.com/');
}

public function testMicroformatsNestedUnderPPropertyClassnamesDeriveValueFromFirstPName() {
Expand Down
14 changes: 7 additions & 7 deletions tests/Mf2/MicroformatsWikiExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testHandlesNullCorrectly() {
}

/**
* From http://microformats.org/wiki/microformats-2
* From https://microformats.org/wiki/microformats-2
*/
public function testSimplePersonReference() {
$input = '<span class="h-card">Frances Berriman</span>';
Expand All @@ -75,7 +75,7 @@ public function testSimplePersonReference() {
}

/**
* From http://microformats.org/wiki/microformats-2
* From https://microformats.org/wiki/microformats-2
*/
public function testSimpleHyperlinkedPersonReference() {
$input = '<a class="h-card" href="http://benward.me">Ben Ward</a>';
Expand All @@ -97,10 +97,10 @@ public function testSimpleHyperlinkedPersonReference() {
}

/**
* From http://microformats.org/wiki/microformats-2-implied-properties
* From https://microformats.org/wiki/microformats-2-implied-properties
*/
public function testSimplePersonImage() {
$input = '<img class="h-card" src="http://example.org/pic.jpg" alt="Chris Messina" />';
$input = '<img class="h-card" src="http://example.com/pic.jpg" alt="Chris Messina" />';
// Added root items key
$expected = '{
"rels": {},
Expand All @@ -110,7 +110,7 @@ public function testSimplePersonImage() {
"properties": {
"name": ["Chris Messina"],
"photo": [{
"value": "http://example.org/pic.jpg",
"value": "http://example.com/pic.jpg",
"alt": "Chris Messina"
}]
}
Expand All @@ -122,7 +122,7 @@ public function testSimplePersonImage() {
}

/**
* From http://microformats.org/wiki/microformats-2-implied-properties
* From https://microformats.org/wiki/microformats-2-implied-properties
*/
public function testHyperlinkedImageNameAndPhotoProperties() {
$input = '<a class="h-card" href="http://rohit.khare.org/">
Expand Down Expand Up @@ -151,7 +151,7 @@ public function testHyperlinkedImageNameAndPhotoProperties() {
}

/**
* From http://microformats.org/wiki/microformats-2
* From https://microformats.org/wiki/microformats-2
*/
public function testMoreDetailedPerson() {
$input = '<div class="h-card">
Expand Down
2 changes: 1 addition & 1 deletion tests/Mf2/ParseDTTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function testDTStartDateOnly() {
/**
* TZ offsets normalized only for VCP.
* This behavior is implied from "However the colons ":" separating the hours and minutes of any timezone offset are optional and discouraged in order to make it less likely that a timezone offset will be confused for a time."
* @see http://microformats.org/wiki/index.php?title=value-class-pattern&oldid=66473##However+the+colons
* @see https://microformats.org/wiki/index.php?title=value-class-pattern&oldid=66473##However+the+colons
*/
public function testNormalizeTZOffsetVCP() {
$input = '<div class="h-event">
Expand Down
Loading

0 comments on commit cff0bef

Please sign in to comment.