You are here

public function Util_XMLTest::testPrepareString in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/tests/Util/XMLTest.php \Util_XMLTest::testPrepareString()

@dataProvider charProvider

File

vendor/phpunit/phpunit/tests/Util/XMLTest.php, line 289

Class

Util_XMLTest
@since Class available since Release 3.3.0 @covers PHPUnit_Util_XML

Code

public function testPrepareString($char) {
  $e = null;
  $escapedString = PHPUnit_Util_XML::prepareString($char);
  $xml = "<?xml version='1.0' encoding='UTF-8' ?><tag>{$escapedString}</tag>";
  $dom = new DomDocument('1.0', 'UTF-8');
  try {
    $dom
      ->loadXML($xml);
  } catch (Exception $e) {
  }
  $this
    ->assertNull($e, sprintf('PHPUnit_Util_XML::prepareString("\\x%02x") should not crash DomDocument', ord($char)));
}