You are here

public function TwigExtensionTest::testsRenderEscapedZeroValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/TwigExtensionTest.php \Drupal\system\Tests\Theme\TwigExtensionTest::testsRenderEscapedZeroValue()

Tests output of integer and double 0 values of TwigExtension::escapeFilter().

See also

https://www.drupal.org/node/2417733

File

core/modules/system/src/Tests/Theme/TwigExtensionTest.php, line 73
Contains \Drupal\system\Tests\Theme\TwigExtensionTest.

Class

TwigExtensionTest
Tests Twig extensions.

Namespace

Drupal\system\Tests\Theme

Code

public function testsRenderEscapedZeroValue() {

  /** @var \Drupal\Core\Template\TwigExtension $extension */
  $extension = \Drupal::service('twig.extension');

  /** @var \Drupal\Core\Template\TwigEnvironment $twig */
  $twig = \Drupal::service('twig');
  $this
    ->assertIdentical($extension
    ->escapeFilter($twig, 0), 0, 'TwigExtension::escapeFilter() returns zero correctly when provided as an integer.');
  $this
    ->assertIdentical($extension
    ->escapeFilter($twig, 0.0), 0, 'TwigExtension::escapeFilter() returns zero correctly when provided as a double.');
}