Added a test for itemid and content attributes
This commit is contained in:
parent
f763ad5b56
commit
d2f6572125
@ -96,6 +96,9 @@ class MicrodataParserTest extends \PHPUnit\Framework\TestCase
|
||||
'Object & Data tags' => [
|
||||
$this->getTestData('Object & Data', 'source.html', 'result.json')
|
||||
],
|
||||
'Itemid & Content attributes' => [
|
||||
$this->getTestData('Itemid & Content', 'source.html', 'result.json')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
14
tests/data/Itemid & Content/result.json
Normal file
14
tests/data/Itemid & Content/result.json
Normal file
@ -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
tests/data/Itemid & Content/source.html
Normal file
15
tests/data/Itemid & Content/source.html
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user