From 29b3a96cb2a53a9fe0fc006ecd790cb2515a09db Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 28 Mar 2009 00:31:08 -0400 Subject: [PATCH] Adding sort() to option parsing, makes testing easier. --- cake/libs/view/helpers/js.php | 1 + cake/tests/cases/libs/view/helpers/js.test.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cake/libs/view/helpers/js.php b/cake/libs/view/helpers/js.php index 8883697fe..78acd57c1 100644 --- a/cake/libs/view/helpers/js.php +++ b/cake/libs/view/helpers/js.php @@ -624,6 +624,7 @@ class JsBaseEngineHelper extends AppHelper { } $out[] = $key . ':' . $value; } + sort($out); return join(', ', $out); } /** diff --git a/cake/tests/cases/libs/view/helpers/js.test.php b/cake/tests/cases/libs/view/helpers/js.test.php index b8dbdff82..923b95f26 100644 --- a/cake/tests/cases/libs/view/helpers/js.test.php +++ b/cake/tests/cases/libs/view/helpers/js.test.php @@ -361,11 +361,11 @@ class JsBaseEngineTestCase extends CakeTestCase { $JsEngine = new OptionEngineHelper(); $result = $JsEngine->testParseOptions(array('url' => '/posts/view/1', 'key' => 1)); - $expected = 'url:"/posts/view/1", key:1'; + $expected = 'key:1, url:"/posts/view/1"'; $this->assertEqual($result, $expected); $result = $JsEngine->testParseOptions(array('url' => '/posts/view/1', 'success' => 'doSuccess'), array('success')); - $expected = 'url:"/posts/view/1", success:doSuccess'; + $expected = 'success:doSuccess, url:"/posts/view/1"'; $this->assertEqual($result, $expected); } }