function _test_theme_twig_php_values

2 calls to _test_theme_twig_php_values()
test_theme_preprocess_twig_theme_test_php_variables in drupal/core/modules/system/tests/themes/test_theme/test_theme.theme
Implements THEME_preprocess_twig_theme_test_php_variables().
ThemeTestTwig::testTwigVariableDataTypes in drupal/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php
Tests that the Twig engine handles PHP data correctly.

File

drupal/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module, line 16

Code

function _test_theme_twig_php_values() {

  // Prefix each variable with "twig_" so that Twig doesn't get confused
  // between a variable and a primitive. Arrays are not tested since they should
  // be a Drupal render array.
  return array(
    'twig_null' => array(
      'value' => NULL,
      'expected' => '',
    ),
    'twig_bool_false' => array(
      'value' => FALSE,
      'expected' => '',
    ),
    'twig_bool_true' => array(
      'value' => TRUE,
      'expected' => '1',
    ),
    'twig_int' => array(
      'value' => 1,
      'expected' => '1',
    ),
    'twig_int_0' => array(
      'value' => 0,
      'expected' => '0',
    ),
    'twig_float' => array(
      'value' => 122.34343,
      'expected' => '122.34343',
    ),
    'twig_string' => array(
      'value' => 'Hello world!',
      'expected' => 'Hello world!',
    ),
  );
}