Skip to content

Commit

Permalink
Added a test for itemid and content attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufkandemir committed Dec 18, 2018
1 parent f763ad5 commit d2f6572
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/MicrodataParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ public function data()
'Object & Data tags' => [
$this->getTestData('Object & Data', 'source.html', 'result.json')
],
'Itemid & Content attributes' => [
$this->getTestData('Itemid & Content', 'source.html', 'result.json')
],
];
}

Expand Down
14 changes: 14 additions & 0 deletions tests/data/Itemid & Content/result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"items": [
{
"id": "urn:isbn:0-330-34032-8",
"type": [ "https://vocab.example.net/book" ],
"properties": {
"title": [ "The Reality Dysfunction" ],
"author": [ "Peter F. Hamilton" ],
"date": [ "1996-01-26" ],
"publisher": [ "Macmillan Publishers Limited" ]
}
}
]
}
15 changes: 15 additions & 0 deletions tests/data/Itemid & Content/source.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- URI: http://books.example.com/the-reality-dysfunction/ -->
<!DOCTYPE HTML>
<html>
<head>
<title>The Reality Dysfunction</title>
</head>
<body>
<div itemscope itemtype="https://vocab.example.net/book" itemid="urn:isbn:0-330-34032-8">
<div>Title: <span itemprop="title">The Reality Dysfunction</span></div>
<div>Author: <span itemprop="author">Peter F. Hamilton</span></div>
<div>Publication date: <time itemprop="date" datetime="1996-01-26">26 January 1996</time></div>
<meta itemprop="publisher" content="Macmillan Publishers Limited">
</div>
</body>
</html>

0 comments on commit d2f6572

Please sign in to comment.