--TEST-- Twig supports the in operator --TEMPLATE-- {{ bar in foo ? 'OK' : 'KO' }} {{ not (bar in foo) ? 'KO' : 'OK' }} {{ bar not in foo ? 'KO' : 'OK' }} {{ 'a' in bar ? 'OK' : 'KO' }} {{ 'c' not in bar ? 'OK' : 'KO' }} {{ '' in bar ? 'OK' : 'KO' }} {{ '' in '' ? 'OK' : 'KO' }} {{ '0' not in '' ? 'OK' : 'KO' }} {{ 'a' not in '0' ? 'OK' : 'KO' }} {{ '0' in '0' ? 'OK' : 'KO' }} {{ false in [0, 1] ? 'OK' : 'KO' }} {{ true in [0, 1] ? 'OK' : 'KO' }} {{ '0' in [0, 1] ? 'OK' : 'KO' }} {{ '0' in [1, 0] ? 'OK' : 'KO' }} {{ '' in [0, 1] ? 'OK' : 'KO' }} {{ '' in [1, 0] ? 'OK' : 'KO' }} {{ 0 in ['', 1] ? 'OK' : 'KO' }} {{ 0 in [1, ''] ? 'OK' : 'KO' }} {{ '' in 'foo' ? 'OK' : 'KO' }} {{ 0 in 'foo' ? 'KO' : 'OK' }} {{ false in 'foo' ? 'KO' : 'OK' }} {{ false in '100' ? 'KO' : 'OK' }} {{ true in '100' ? 'KO' : 'OK' }} {{ [] in [true, false] ? 'OK' : 'KO' }} {{ [] in [true, ''] ? 'KO' : 'OK' }} {{ [] in [true, []] ? 'OK' : 'KO' }} {{ resource ? 'OK' : 'KO' }} {{ resource in 'foo'~resource ? 'KO' : 'OK' }} {{ object in 'stdClass' ? 'KO' : 'OK' }} {{ [] in 'Array' ? 'KO' : 'OK' }} {{ dir_object in 'foo'~dir_object ? 'KO' : 'OK' }} {{ ''~resource in resource ? 'KO' : 'OK' }} {{ 'stdClass' in object ? 'KO' : 'OK' }} {{ 'Array' in [] ? 'KO' : 'OK' }} {{ ''~dir_object in dir_object ? 'KO' : 'OK' }} {{ resource in [''~resource] ? 'KO' : 'OK' }} {{ resource in [resource + 1 - 1] ? 'KO' : 'OK' }} {{ dir_object in [''~dir_object] ? 'KO' : 'OK' }} {{ 5 in 125 ? 'KO' : 'OK' }} {{ 5 in '125' ? 'OK' : 'KO' }} {{ '5' in 125 ? 'KO' : 'OK' }} {{ '5' in '125' ? 'OK' : 'KO' }} {{ 5.5 in 125.5 ? 'KO' : 'OK' }} {{ 5.5 in '125.5' ? 'OK' : 'KO' }} {{ '5.5' in 125.5 ? 'KO' : 'OK' }} {{ safe in ['foo', 'bar'] ? 'OK' : 'KO' }} {{ 'fo' in safe ? 'OK' : 'KO' }} --DATA-- return ['bar' => 'bar', 'foo' => ['bar' => 'bar'], 'dir_object' => new \SplFileInfo(__DIR__), 'object' => new \stdClass(), 'resource' => opendir(__DIR__), 'safe' => new \Twig\Markup('foo', 'UTF-8')] --EXPECT-- OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
array.test | File | 336 B | 0644 |
|
constant.test | File | 388 B | 0644 |
|
defined.test | File | 2.95 KB | 0644 |
|
defined_for_attribute.test | File | 752 B | 0644 |
|
defined_for_blocks.test | File | 888 B | 0644 |
|
defined_for_blocks_with_template.test | File | 488 B | 0644 |
|
defined_for_constants.test | File | 388 B | 0644 |
|
defined_for_macros.test | File | 480 B | 0644 |
|
defined_on_complex_expr.test | File | 241 B | 0644 |
|
dynamic_test.test | File | 213 B | 0644 |
|
empty.test | File | 1.81 KB | 0644 |
|
even.test | File | 204 B | 0644 |
|
in.test | File | 2.08 KB | 0644 |
|
in_with_objects.test | File | 343 B | 0644 |
|
iterable.test | File | 345 B | 0644 |
|
null_coalesce.test | File | 452 B | 0644 |
|
null_coalesce_block.test | File | 158 B | 0644 |
|
odd.test | File | 126 B | 0644 |
|