]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
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 |