function JsonTest::setUp
File
- 
              core/
tests/ Drupal/ Tests/ Component/ Serialization/ JsonTest.php, line 38  
Class
- JsonTest
 - @coversDefaultClass \Drupal\Component\Serialization\Json[[api-linebreak]] @group Serialization
 
Namespace
Drupal\Tests\Component\SerializationCode
protected function setUp() : void {
  parent::setUp();
  // Setup a string with the full ASCII table.
  // @todo: Add tests for non-ASCII characters and Unicode.
  $this->string = '';
  for ($i = 1; $i < 128; $i++) {
    $this->string .= chr($i);
  }
  // Characters that must be escaped.
  // We check for unescaped " separately.
  $this->htmlUnsafe = [
    '<',
    '>',
    '\'',
    '&',
  ];
  // The following are the encoded forms of: < > ' & "
  $this->htmlUnsafeEscaped = [
    '\\u003C',
    '\\u003E',
    '\\u0027',
    '\\u0026',
    '\\u0022',
  ];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.