2016-06-05 16:03:42 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
namespace PhpOffice\PhpSpreadsheetTests;
|
2016-06-05 16:03:42 +00:00
|
|
|
|
|
|
|
class SettingsTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
2017-03-12 13:00:46 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $prevValue;
|
|
|
|
|
2016-06-05 16:03:42 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2017-03-12 13:00:46 +00:00
|
|
|
$this->prevValue = libxml_disable_entity_loader();
|
|
|
|
libxml_disable_entity_loader(false); // Enable entity loader
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function tearDown()
|
|
|
|
{
|
|
|
|
libxml_disable_entity_loader($this->prevValue);
|
2016-06-05 16:03:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetXMLSettings()
|
|
|
|
{
|
2016-08-31 17:18:12 +00:00
|
|
|
$result = \PhpOffice\PhpSpreadsheet\Settings::getLibXmlLoaderOptions();
|
2016-06-05 16:03:42 +00:00
|
|
|
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result));
|
2017-03-12 13:00:46 +00:00
|
|
|
$this->assertFalse(libxml_disable_entity_loader());
|
2016-06-05 16:03:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testSetXMLSettings()
|
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
\PhpOffice\PhpSpreadsheet\Settings::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID);
|
2016-08-31 17:18:12 +00:00
|
|
|
$result = \PhpOffice\PhpSpreadsheet\Settings::getLibXmlLoaderOptions();
|
2016-06-05 16:03:42 +00:00
|
|
|
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
|
2017-03-12 13:00:46 +00:00
|
|
|
$this->assertFalse(libxml_disable_entity_loader());
|
2016-06-05 16:03:42 +00:00
|
|
|
}
|
|
|
|
}
|