Skip to content

Commit 5aef3ec

Browse files
committed
Updated existing tests that started failing after adding language parsing.
1 parent 9dbb991 commit 5aef3ec

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

tests/Mf2/ClassicMicroformatsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ public function setUp() {
2424

2525
public function testParsesClassicHcard() {
2626
$input = '<div class="vcard"><span class="fn n">Barnaby Walters</span> is a person.</div>';
27-
$expected = '{"items": [{"type": ["h-card"], "properties": {"name": ["Barnaby Walters"]}}], "rels": {}}';
27+
$expected = '{"items": [{"type": ["h-card"], "properties": {"name": ["Barnaby Walters"], "html-lang": ""}}], "rels": {}}';
2828
$parser = new Parser($input, '', true);
2929
$this->assertJsonStringEqualsJsonString(json_encode($parser->parse()), $expected);
3030
}
3131

3232
public function testParsesClassicHEntry() {
3333
$input = '<div class="hentry"><h1 class="entry-title">microformats2 Is Great</h1> <p class="entry-summary">yes yes it is.</p></div>';
34-
$expected = '{"items": [{"type": ["h-entry"], "properties": {"name": ["microformats2 Is Great"], "summary": ["yes yes it is."]}}], "rels": {}}';
34+
$expected = '{"items": [{"type": ["h-entry"], "properties": {"name": ["microformats2 Is Great"], "summary": ["yes yes it is."], "html-lang": ""}}], "rels": {}}';
3535
$parser = new Parser($input, '', true);
3636
$this->assertJsonStringEqualsJsonString(json_encode($parser->parse()), $expected);
3737
}

tests/Mf2/CombinedMicroformatsTest.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function testHEventLocationHCard() {
4242
"properties": {
4343
"name": ["IndieWebCamp 2012"],
4444
"url": ["http://indiewebcamp.com/2012"],
45+
"html-lang": "",
4546
"start": ["2012-06-30"],
4647
"end": ["2012-07-01"],
4748
"location": [{
@@ -51,6 +52,7 @@ public function testHEventLocationHCard() {
5152
"name": ["Geoloqi"],
5253
"org": ["Geoloqi"],
5354
"url": ["http://geoloqi.com/"],
55+
"html-lang": "",
5456
"street-address": ["920 SW 3rd Ave. Suite 400"],
5557
"locality": ["Portland"],
5658
"region": ["Oregon"]
@@ -84,7 +86,8 @@ public function testHCardOrgPOrg() {
8486
"properties": {
8587
"name": ["Mitchell Baker"],
8688
"url": ["http://blog.lizardwrangler.com/"],
87-
"org": ["Mozilla Foundation"]
89+
"org": ["Mozilla Foundation"],
90+
"html-lang": ""
8891
}
8992
}]
9093
}';
@@ -115,12 +118,14 @@ public function testHCardOrgHCard() {
115118
"properties": {
116119
"name": ["Mitchell Baker"],
117120
"url": ["http://blog.lizardwrangler.com/"],
121+
"html-lang": "",
118122
"org": [{
119123
"value": "Mozilla Foundation",
120124
"type": ["h-card"],
121125
"properties": {
122126
"name": ["Mozilla Foundation"],
123-
"url": ["http://mozilla.org/"]
127+
"url": ["http://mozilla.org/"],
128+
"html-lang": ""
124129
}
125130
}]
126131
}
@@ -153,12 +158,14 @@ public function testHCardPOrgHCardHOrg() {
153158
"properties": {
154159
"name": ["Mitchell Baker"],
155160
"url": ["http://blog.lizardwrangler.com/"],
161+
"html-lang": "",
156162
"org": [{
157163
"value": "Mozilla Foundation",
158164
"type": ["h-card", "h-org"],
159165
"properties": {
160166
"name": ["Mozilla Foundation"],
161-
"url": ["http://mozilla.org/"]
167+
"url": ["http://mozilla.org/"],
168+
"html-lang": ""
162169
}
163170
}]
164171
}
@@ -188,13 +195,15 @@ public function testHCardChildHCard() {
188195
"type": ["h-card"],
189196
"properties": {
190197
"name": ["Mitchell Baker"],
191-
"url": ["http://blog.lizardwrangler.com/"]
198+
"url": ["http://blog.lizardwrangler.com/"],
199+
"html-lang": ""
192200
},
193201
"children": [{
194202
"type": ["h-card","h-org"],
195203
"properties": {
196204
"name": ["Mozilla Foundation"],
197-
"url": ["http://mozilla.org/"]
205+
"url": ["http://mozilla.org/"],
206+
"html-lang": ""
198207
},
199208
"value": "Mozilla Foundation"
200209
}]
@@ -262,23 +271,27 @@ public function testMicroformatsNestedUnderUPropertyClassnamesDeriveValueFromURL
262271
"name": ["Name"],
263272
"content": [{
264273
"html": "Hello World",
265-
"value": "Hello World"
274+
"value": "Hello World",
275+
"html-lang": ""
266276
}],
277+
"html-lang": "",
267278
"comment": [{
268279
"type": ["h-cite"],
269280
"properties": {
270281
"author": [{
271282
"type": ["h-card"],
272283
"properties": {
273284
"name": ["Jane Bloggs"],
274-
"url": ["http:\/\/jane.example.com\/"]
285+
"url": ["http:\/\/jane.example.com\/"],
286+
"html-lang": ""
275287
},
276288
"value": "http:\/\/jane.example.com\/"
277289
}],
278290
"content": ["lol"],
279291
"name": ["lol"],
280292
"url": ["http:\/\/example.org\/post1234"],
281-
"published": ["2015-07-12 12:03"]
293+
"published": ["2015-07-12 12:03"],
294+
"html-lang": ""
282295
},
283296
"value": "http:\/\/example.org\/post1234"
284297
}]

tests/Mf2/MicroformatsWikiExamplesTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public function testSimplePersonReference() {
6262
"items": [{
6363
"type": ["h-card"],
6464
"properties": {
65-
"name": ["Frances Berriman"]
65+
"name": ["Frances Berriman"],
66+
"html-lang": ""
6667
}
6768
}]
6869
}';
@@ -83,7 +84,8 @@ public function testSimpleHyperlinkedPersonReference() {
8384
"type": ["h-card"],
8485
"properties": {
8586
"name": ["Ben Ward"],
86-
"url": ["http://benward.me"]
87+
"url": ["http://benward.me"],
88+
"html-lang": ""
8789
}
8890
}]
8991
}';
@@ -105,7 +107,8 @@ public function testSimplePersonImage() {
105107
"type": ["h-card"],
106108
"properties": {
107109
"name": ["Chris Messina"],
108-
"photo": ["http://example.org/pic.jpg"]
110+
"photo": ["http://example.org/pic.jpg"],
111+
"html-lang": ""
109112
}
110113
}]}';
111114
$parser = new Parser($input, '', true);
@@ -130,7 +133,8 @@ public function testHyperlinkedImageNameAndPhotoProperties() {
130133
"properties": {
131134
"name": ["Rohit Khare"],
132135
"url": ["http://rohit.khare.org/"],
133-
"photo": ["https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg"]
136+
"photo": ["https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg"],
137+
"html-lang": ""
134138
}
135139
}]}';
136140
$parser = new Parser($input, '', true);
@@ -176,7 +180,8 @@ public function testMoreDetailedPerson() {
176180
"category": [
177181
"Strategy",
178182
"Leadership"
179-
]
183+
],
184+
"html-lang": ""
180185
}
181186
}]
182187
}';

tests/Mf2/ParseImpliedTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,33 @@ public function testMultipleImpliedHCards() {
133133
"items": [{
134134
"type": ["h-card"],
135135
"properties": {
136-
"name": ["Frances Berriman"]
136+
"name": ["Frances Berriman"],
137+
"html-lang": ""
137138
}
138139
},
139140
{
140141
"type": ["h-card"],
141142
"properties": {
142143
"name": ["Ben Ward"],
143-
"url": ["http://benward.me"]
144+
"url": ["http://benward.me"],
145+
"html-lang": ""
144146
}
145147
},
146148
{
147149
"type": ["h-card"],
148150
"properties": {
149151
"name": ["Sally Ride"],
150-
"photo": ["http://upload.wikimedia.org/wikipedia/commons/a/a4/Ride-s.jpg"]
152+
"photo": ["http://upload.wikimedia.org/wikipedia/commons/a/a4/Ride-s.jpg"],
153+
"html-lang": ""
151154
}
152155
},
153156
{
154157
"type": ["h-card"],
155158
"properties": {
156159
"name": ["Tantek Çelik"],
157160
"url": ["http://tantek.com"],
158-
"photo": ["http://ttk.me/logo.jpg"]
161+
"photo": ["http://ttk.me/logo.jpg"],
162+
"html-lang": ""
159163
}
160164
}]
161165
}';

0 commit comments

Comments
 (0)