Permalink
Browse files

Adding sort() to option parsing, makes testing easier.

  • Loading branch information...
1 parent 9708b2d commit 29b3a96cb2a53a9fe0fc006ecd790cb2515a09db @markstory markstory committed Mar 28, 2009
Showing with 3 additions and 2 deletions.
  1. +1 −0 cake/libs/view/helpers/js.php
  2. +2 −2 cake/tests/cases/libs/view/helpers/js.test.php
@@ -624,6 +624,7 @@ function _parseOptions($options, $safeKeys = array()) {
}
$out[] = $key . ':' . $value;
}
+ sort($out);
return join(', ', $out);
}
/**
@@ -361,11 +361,11 @@ function testOptionParsing() {
$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);
}
}

0 comments on commit 29b3a96

Please sign in to comment.