X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flibs%2FXmlTypeCheckTest.php;h=c43d550a74dda5dab1ff46846b3446a9580fb30e;hb=01c3bf3431e9754b79e4a4a31fa74ce9e6616514;hp=f0ba934e0b77adc4a0d64c0075cbac5f1b7ec46d;hpb=d3073583f1683586521cdc8e66633f215a9cca6e;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/libs/XmlTypeCheckTest.php b/tests/phpunit/includes/libs/XmlTypeCheckTest.php
index f0ba934e0b..5c5eeaa702 100644
--- a/tests/phpunit/includes/libs/XmlTypeCheckTest.php
+++ b/tests/phpunit/includes/libs/XmlTypeCheckTest.php
@@ -8,7 +8,9 @@
class XmlTypeCheckTest extends PHPUnit_Framework_TestCase {
const WELL_FORMED_XML = "";
const MAL_FORMED_XML = "";
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
const XML_WITH_PIH = '';
+ // @codingStandardsIgnoreEnd
/**
* @covers XMLTypeCheck::newFromString
@@ -28,6 +30,32 @@ class XmlTypeCheckTest extends PHPUnit_Framework_TestCase {
$this->assertFalse( $testXML->wellFormed );
}
+ /**
+ * Verify we check for recursive entity DOS
+ *
+ * (If the DOS isn't properly handled, the test runner will probably go OOM...)
+ */
+ public function testRecursiveEntity() {
+ $xml = <<<'XML'
+
+
+
+
+
+
+
+
+
+]>
+
+&test;
+
+XML;
+ $check = XmlTypeCheck::newFromString( $xml );
+ $this->assertFalse( $check->wellFormed );
+ }
+
/**
* @covers XMLTypeCheck::processingInstructionHandler
*/
@@ -37,11 +65,11 @@ class XmlTypeCheckTest extends PHPUnit_Framework_TestCase {
self::XML_WITH_PIH,
null,
false,
- array(
- 'processing_instruction_handler' => function() use ( &$called ) {
+ [
+ 'processing_instruction_handler' => function () use ( &$called ) {
$called = true;
}
- )
+ ]
);
$this->assertTrue( $called );
}