PhpSpreadsheet/tests/PhpSpreadsheetTests/SettingsTest.php

41 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace PhpOffice\PhpSpreadsheetTests;
use PhpOffice\PhpSpreadsheet\Settings;
use PHPUnit\Framework\TestCase;
class SettingsTest extends TestCase
{
/**
* @var string
*/
protected $prevValue;
2020-04-27 10:28:36 +00:00
protected function setUp(): void
{
$this->prevValue = libxml_disable_entity_loader();
libxml_disable_entity_loader(false); // Enable entity loader
}
2020-04-27 10:28:36 +00:00
protected function tearDown(): void
{
libxml_disable_entity_loader($this->prevValue);
}
2020-05-18 04:49:57 +00:00
public function testGetXMLSettings(): void
{
$result = Settings::getLibXmlLoaderOptions();
self::assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result));
self::assertFalse(libxml_disable_entity_loader());
}
2020-05-18 04:49:57 +00:00
public function testSetXMLSettings(): void
{
Settings::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID);
$result = Settings::getLibXmlLoaderOptions();
self::assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
self::assertFalse(libxml_disable_entity_loader());
}
}