/** * @covers sasort * @group stablesort */ public function testSasort() { $source = array('a' => 3, 'b' => 2, 'c' => 2, 'd' => 1); $expected = array('d' => 1, 'b' => 2, 'c' => 2, 'a' => 3); $array = $source; sasort($array); $this->assertSame($expected, $array); }
/** * * * @since 1.0.0 * @return array Sorted comments array */ public function get_comment_sort_replies($comments, $direction_bool) { // returns array[0]= reply count, array[1]=date stamps $walk = new Co_Mment_Walker_Sort(); $walkOutput = $walk->walk($comments, 0); $walkOutputReplies = $walkOutput[0]; if ($direction_bool == true) { sasort($walkOutputReplies); } else { sarsort($walkOutputReplies); } $comment_root_sorted = $walkOutputReplies; $comments_sorted = $this->merge_comment_array($comments, $comment_root_sorted); return $comments_sorted; }
/** * @covers sasort * @group stablesort */ public function testRegular() { $array = array('a9', 'a1', 'a10'); sasort($array, SORT_REGULAR); $this->assertNotSame(array(1 => 'a1', 0 => 'a9', 2 => 'a10'), $array); }