0b1e09ea0e80c6b9c5a08500654399b5a81f1f78
[yaffs-website] / vendor / twig / twig / test / Twig / Tests / Fixtures / filters / length.test
1 --TEST--
2 "length" filter
3 --TEMPLATE--
4 {{ array|length }}
5 {{ string|length }}
6 {{ number|length }}
7 {{ to_string_able|length }}
8 {{ countable|length }}
9 {{ iterator_aggregate|length }}
10 {{ null|length }}
11 {{ magic|length }}
12 {{ non_countable|length }}
13 --DATA--
14 return array(
15     'array' => array(1, 4),
16     'string' => 'foo',
17     'number' => 1000,
18     'to_string_able' => new ToStringStub('foobar'),
19     'countable' => new CountableStub(42),       /* also asserts we do *not* call __toString() */
20     'iterator_aggregate' => new IteratorAggregateStub(array('a', 'b', 'c')),   /* also asserts we do *not* call __toString() */
21     'null'          => null,
22     'magic'         => new MagicCallStub(),     /* used to assert we do *not* call __call */
23     'non_countable' => new \StdClass(),
24 );
25 --EXPECT--
26 2
27 3
28 4
29 6
30 42
31 3
32 0
33 1
34 1