--TEST-- "defined" test --TEMPLATE-- {{ definedVar is defined ? 'ok' : 'ko' }} {{ definedVar is not defined ? 'ko' : 'ok' }} {{ undefinedVar is defined ? 'ko' : 'ok' }} {{ undefinedVar is not defined ? 'ok' : 'ko' }} {{ zeroVar is defined ? 'ok' : 'ko' }} {{ nullVar is defined ? 'ok' : 'ko' }} {{ nested.definedVar is defined ? 'ok' : 'ko' }} {{ nested['definedVar'] is defined ? 'ok' : 'ko' }} {{ nested.definedVar is not defined ? 'ko' : 'ok' }} {{ nested.undefinedVar is defined ? 'ko' : 'ok' }} {{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }} {{ nested.undefinedVar is not defined ? 'ok' : 'ko' }} {{ nested.zeroVar is defined ? 'ok' : 'ko' }} {{ nested.nullVar is defined ? 'ok' : 'ko' }} {{ nested.definedArray.0 is defined ? 'ok' : 'ko' }} {{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }} {{ object.foo is defined ? 'ok' : 'ko' }} {{ object.undefinedMethod is defined ? 'ko' : 'ok' }} {{ object.getFoo() is defined ? 'ok' : 'ko' }} {{ object.getFoo('a') is defined ? 'ok' : 'ko' }} {{ object.undefinedMethod() is defined ? 'ko' : 'ok' }} {{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }} {{ object.self.foo is defined ? 'ok' : 'ko' }} {{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }} {{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }} {{ 0 is defined ? 'ok' : 'ko' }} {{ "foo" is defined ? 'ok' : 'ko' }} {{ true is defined ? 'ok' : 'ko' }} {{ false is defined ? 'ok' : 'ko' }} {{ null is defined ? 'ok' : 'ko' }} {{ [1, 2] is defined ? 'ok' : 'ko' }} {{ { foo: "bar" } is defined ? 'ok' : 'ko' }} --DATA-- return [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, 'nested' => [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, 'definedArray' => [0], ], 'object' => new TwigTestFoo(), ] --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 --DATA-- return [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, 'nested' => [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, 'definedArray' => [0], ], 'object' => new TwigTestFoo(), ] --CONFIG-- return ['strict_variables' => false] --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
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
array.test | File | 336 B | 0644 |
|
constant.test | File | 362 B | 0644 |
|
defined.test | File | 2.93 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.26 KB | 0644 |
|
even.test | File | 204 B | 0644 |
|
in.test | File | 2.08 KB | 0644 |
|
in_with_objects.test | File | 321 B | 0644 |
|
iterable.test | File | 345 B | 0644 |
|
null_coalesce.test | File | 452 B | 0644 |
|
odd.test | File | 126 B | 0644 |
|