ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ArrayTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) Fabien Potencier
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11require_once __DIR__.'/../../../../lib/Twig/Extensions/Extension/Array.php';
12
14{
18 public function testShuffleFilter($data, $expectedElements)
19 {
20 foreach ($expectedElements as $element) {
21 $this->assertTrue(in_array($element, twig_shuffle_filter($data), true)); // assertContains() would not consider the type
22 }
23 }
24
26 {
27 $this->assertEquals(array(), twig_shuffle_filter(array()));
28 }
29
30 public function getShuffleFilterTestData()
31 {
32 return array(
33 array(
34 array(1, 2, 3),
35 array(1, 2, 3),
36 ),
37 array(
38 array('a' => 'apple', 'b' => 'orange', 'c' => 'citrus'),
39 array('apple', 'orange', 'citrus'),
40 ),
41 array(
42 new ArrayObject(array('apple', 'orange', 'citrus')),
43 array('apple', 'orange', 'citrus'),
44 ),
45 );
46 }
47}
An exception for terminatinating execution or to throw for unit testing.
testShuffleFilter($data, $expectedElements)
@dataProvider getShuffleFilterTestData
Definition: ArrayTest.php:18
twig_shuffle_filter($array)
Shuffles an array.
Definition: Array.php:45