You are here

public function TwigConvertTest::providerTestStringValues in Twig Tools 8

Provides test data for testStringValue.

Return value

array An array of test data and their string equivalents.

File

tests/src/Unit/TwigConvertTest.php, line 177

Class

TwigConvertTest
Tests to ensure conversions filters work correctly.

Namespace

Drupal\Tests\twig_tools\Unit

Code

public function providerTestStringValues() {
  return [
    [
      "{{ 42|string }}",
      "42",
    ],
    [
      "{{ 4.2|string }}",
      "4.2",
    ],
    [
      "{{ '42'|string }}",
      "42",
    ],
    [
      "{{ '+42'|string }}",
      "+42",
    ],
    [
      "{{ '-42'|string }}",
      "-42",
    ],
    [
      "{{ 042|string }}",
      "42",
    ],
    [
      "{{ '042'|string }}",
      "042",
    ],
    [
      "{{ 42000000|string }}",
      "42000000",
    ],
    [
      "{{ FALSE|string }}",
      "",
    ],
    [
      "{{ TRUE|string }}",
      "1",
    ],
    [
      "{{ NULL|string }}",
      "",
    ],
    [
      "{{ 0|string }}",
      "0",
    ],
    [
      "{{ 1|string }}",
      "1",
    ],
    [
      "{{ 0.0|string }}",
      "0",
    ],
    [
      "{{ 1.0|string }}",
      "1",
    ],
  ];
}