From dfe2ead19e19910b8253d3e7be19f46c3b83f6a0 Mon Sep 17 00:00:00 2001 From: nate Date: Sat, 8 Mar 2008 20:37:55 +0000 Subject: [PATCH] Removing methods from Set test case git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6524 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/libs/set.test.php | 52 +----------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/cake/tests/cases/libs/set.test.php b/cake/tests/cases/libs/set.test.php index 5ed3511e9..f72c64722 100644 --- a/cake/tests/cases/libs/set.test.php +++ b/cake/tests/cases/libs/set.test.php @@ -1077,7 +1077,6 @@ class SetTest extends UnitTestCase { ) )); $this->assertEqual($result, $expected); - $string =''; $xml = new Xml($string); @@ -1090,55 +1089,6 @@ class SetTest extends UnitTestCase { $set = new Set(array('a' => 'hi')); $this->assertFalse($set->check('a.b')); } - - function __flatten($results, $key = null) { - $stack = array(); - foreach ($results as $k => $r) { - if (is_array($r)) { - $stack = am($stack, Set::__flatten($r, $k)); - } else { - if (!$key) { - $key = $k; - } - $stack[] = array( - 'id' => $key, - 'value' => $r - ); - } - } - return $stack; - } - - /** - * Sorts an array by any value, determined by a Set-compatible path - * - * @param array $data - * @param string $path A Set-compatible path to the array value - * @param string $dir asc/desc - * @return unknown - */ - function sort($data, $path, $dir) { - - $result = Set::extract($data, $path); - $result = Set::__flatten($result); - $keys = Set::extract($result, '{n}.id'); - $values = Set::extract($result, '{n}.value'); - - if ($dir == 'asc') { - $dir = SORT_ASC; - } - if ($dir == 'desc') { - $dir = SORT_DESC; - } - - array_multisort($values, $dir, $keys, $dir); - - $sorted = array(); - foreach ($keys as $k) { - $sorted[] = $data[$k]; - } - return $sorted; - } - } + ?> \ No newline at end of file