Files

49 lines
1.0 KiB
PHP

<?php
namespace TorstenHettstedt\XmlReader\Sax\Tests\Unit;
use Codeception\Stub\Expected;
use Codeception\Test\Unit;
use Exception;
use TorstenHettstedt\XmlReader\Sax\XmlReaderInterfaces;
use TorstenHettstedt\XmlReader\Sax\XmlSaxParser;
class XmlSaxParserTest extends Unit
{
const XML_DATA = <<<XML
<?xml version = "1.0" encoding = "utf-8"?>
<tutors>
<course>
<name>Android</name>
<email>contact@tutorialspoint.com</email>
</course>
<course>
<name>Java</name>
</course>
</tutors>
XML;
protected $xmlReader = null;
/**
* @throws Exception
*/
protected function setUp(): void
{
parent::setUp();
$this->xmlReader = $this->makeEmpty(XmlReaderInterfaces::class, [
'tag_open' => Expected::exactly(6),
'cdata' => Expected::exactly(3),
'tag_close' => Expected::exactly(6),
]);
}
public function testParse()
{
$reader = new XmlSaxParser($this->xmlReader);
$reader->parse(self::XML_DATA);
}
}