public function testSort() { $list = new ArrayList(['world', 'Carol', 'hello', 'Bob', 'Alice']); $list->sort(); $this->assertEquals('Alice', $list[0]); $list->sort(function ($a, $b) { if ($a > $b) { return -1; } if ($b > $a) { return 1; } return 0; }); $this->assertEquals('Alice', $list[4]); }