You are here

public function TwigExtensionTest::testsRenderZeroValue in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php \Drupal\Tests\system\Functional\Theme\TwigExtensionTest::testsRenderZeroValue()
  2. 10 core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php \Drupal\Tests\system\Functional\Theme\TwigExtensionTest::testsRenderZeroValue()

Tests output of integer and double 0 values of TwigExtension->renderVar().

See also

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

File

core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php, line 88

Class

TwigExtensionTest
Tests Twig extensions.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testsRenderZeroValue() {

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