File: cycle.test

package info (click to toggle)
php-twig 3.22.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,408 kB
  • sloc: php: 24,892; makefile: 111; sh: 43
file content (20 lines) | stat: -rw-r--r-- 378 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
"cycle" function
--TEMPLATE--
{% for i in 0..6 %}
{{ cycle(array1, i) }}-{{ cycle(array2, i) }}-{{ cycle(array3, i) }}
{% endfor %}
--DATA--
return [
    'array1' => ['odd', 'even'],
    'array2' => ['apple', 'orange', 'citrus'],
    'array3' => [1, 2, false, null],
];
--EXPECT--
odd-apple-1
even-orange-2
odd-citrus-
even-apple-
odd-orange-1
even-citrus-2
odd-apple-