public function TwigConvertTest::providerTestIntegerValues in Twig Tools 8
Provides test data for testIntegerValue.
Return value
array An array of test data and their integer equivalents.
File
- tests/
src/ Unit/ TwigConvertTest.php, line 88
Class
- TwigConvertTest
- Tests to ensure conversions filters work correctly.
Namespace
Drupal\Tests\twig_tools\UnitCode
public function providerTestIntegerValues() {
return [
[
"{{ 42|integer }}",
'42',
],
[
"{{ 4.2|integer }}",
'4',
],
[
"{{ '42'|integer }}",
'42',
],
[
"{{ '+42'|integer }}",
'42',
],
[
"{{ '-42'|integer }}",
'-42',
],
[
"{{ 042|integer }}",
'42',
],
[
"{{ '042'|integer }}",
'42',
],
[
"{{ 42000000|integer }}",
'42000000',
],
[
"{{ []|integer }}",
'0',
],
[
"{{ ['foo', 'bar']|integer }}",
'1',
],
[
"{{ FALSE|integer }}",
'0',
],
[
"{{ TRUE|integer }}",
'1',
],
[
"{{ NULL|integer }}",
'0',
],
[
"{{ 0|integer }}",
'0',
],
[
"{{ 1|integer }}",
'1',
],
[
"{{ 0.0|integer }}",
'0',
],
[
"{{ 1.0|integer }}",
'1',
],
];
}