public function testThatArrayIsShuffled() { //Test that null is returned if an empty array is provdied $this->assertEquals(null, CollectionUtility::shuffle([])); //Test rest of function $items = [["a" => 1], ["a" => 2]]; $attempts = 0; $different = false; while ($attempts++ < 50) { $shuffled = CollectionUtility::shuffle($items); if ($shuffled != $items) { $different = true; break; } } if (!$different) { $this->fail("Items not shuffled after 50 tests, probably not good shuffling but run test again to be sure"); } }