public function testPreventsComplexExternalEntities() {
$oldCwd = getcwd();
chdir(__DIR__);
try {
$this->encoder
->decode('<?xml version="1.0"?><!DOCTYPE scan[<!ENTITY test SYSTEM "php://filter/read=convert.base64-encode/resource=XmlEncoderTest.php">]><scan>&test;</scan>', 'xml');
chdir($oldCwd);
$this
->fail('No exception was thrown.');
} catch (\Exception $e) {
chdir($oldCwd);
if (!$e instanceof UnexpectedValueException) {
$this
->fail('Expected UnexpectedValueException');
}
}
}