2018-11-12 12:25:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace YusufKandemir\MicrodataParser\Tests;
|
|
|
|
|
|
|
|
use YusufKandemir\MicrodataParser\Microdata;
|
|
|
|
use YusufKandemir\MicrodataParser\MicrodataParser;
|
|
|
|
|
|
|
|
class MicrodataTest extends \PHPUnit\Framework\TestCase
|
|
|
|
{
|
|
|
|
protected $htmlFileName = __DIR__ . '/data/W3C/source.html';
|
|
|
|
|
2018-11-12 16:23:35 +00:00
|
|
|
public function testItCreatesMicrodataParserFromHtml()
|
2018-11-12 12:25:04 +00:00
|
|
|
{
|
|
|
|
$html = file_get_contents($this->htmlFileName);
|
|
|
|
$microdata = Microdata::fromHTML($html);
|
|
|
|
|
|
|
|
$this->assertInstanceOf(MicrodataParser::class, $microdata);
|
|
|
|
}
|
|
|
|
|
2018-11-12 16:23:35 +00:00
|
|
|
public function testItCreatesMicrodataParserFromHtmlFile()
|
2018-11-12 12:25:04 +00:00
|
|
|
{
|
|
|
|
$microdata = Microdata::fromHTMLFile($this->htmlFileName);
|
|
|
|
|
|
|
|
$this->assertInstanceOf(MicrodataParser::class, $microdata);
|
|
|
|
}
|
|
|
|
|
2018-11-12 16:23:35 +00:00
|
|
|
public function testItCreatesMicrodataParserFromDomDocument()
|
2018-11-12 12:25:04 +00:00
|
|
|
{
|
|
|
|
$dom = new \DOMDocument;
|
|
|
|
$dom->loadHTMLFile($this->htmlFileName);
|
|
|
|
|
|
|
|
$microdata = Microdata::fromDOMDocument($dom);
|
|
|
|
|
|
|
|
$this->assertInstanceOf(MicrodataParser::class, $microdata);
|
|
|
|
}
|
|
|
|
}
|