You are here

protected function JsonTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Serialization/JsonTest.php \Drupal\Tests\Component\Serialization\JsonTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Component/Serialization/JsonTest.php, line 44
Contains \Drupal\Tests\Component\Serialization\JsonTest.

Class

JsonTest
@coversDefaultClass \Drupal\Component\Serialization\Json @group Serialization

Namespace

Drupal\Tests\Component\Serialization

Code

protected function setUp() {
  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 = array(
    '<',
    '>',
    '\'',
    '&',
  );

  // The following are the encoded forms of: < > ' & "
  $this->htmlUnsafeEscaped = array(
    '\\u003C',
    '\\u003E',
    '\\u0027',
    '\\u0026',
    '\\u0022',
  );
}