diff options
Diffstat (limited to 'vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test')
-rw-r--r-- | vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test new file mode 100644 index 00000000..159db96f --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test | |||
@@ -0,0 +1,27 @@ | |||
1 | --TEST-- | ||
2 | Twig supports __call() for attributes | ||
3 | --TEMPLATE-- | ||
4 | {{ foo.foo }} | ||
5 | {{ foo.bar }} | ||
6 | --DATA-- | ||
7 | class TestClassForMagicCallAttributes | ||
8 | { | ||
9 | public function getBar() | ||
10 | { | ||
11 | return 'bar_from_getbar'; | ||
12 | } | ||
13 | |||
14 | public function __call($method, $arguments) | ||
15 | { | ||
16 | if ('foo' === $method) | ||
17 | { | ||
18 | return 'foo_from_call'; | ||
19 | } | ||
20 | |||
21 | return false; | ||
22 | } | ||
23 | } | ||
24 | return array('foo' => new TestClassForMagicCallAttributes()) | ||
25 | --EXPECT-- | ||
26 | foo_from_call | ||
27 | bar_from_getbar | ||