diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php
index c8c055f16..5b9603af9 100644
--- a/cake/libs/view/helpers/javascript.php
+++ b/cake/libs/view/helpers/javascript.php
@@ -373,7 +373,7 @@ class JavascriptHelper extends AppHelper {
if ((!count($stringKeys) && !is_numeric($val) && !is_bool($val)) || ($quoteKeys && in_array($key, $stringKeys, true)) || (!$quoteKeys && !in_array($key, $stringKeys, true))) {
$val = $q . $this->escapeString($val) . $q;
}
- if ($val == null) {
+ if ($val === null) {
$val = 'null';
}
}
diff --git a/cake/tests/cases/libs/view/helpers/javascript.test.php b/cake/tests/cases/libs/view/helpers/javascript.test.php
index 81effda0b..909d24df2 100644
--- a/cake/tests/cases/libs/view/helpers/javascript.test.php
+++ b/cake/tests/cases/libs/view/helpers/javascript.test.php
@@ -49,19 +49,19 @@ class JavascriptTest extends UnitTestCase {
function testLink() {
$result = $this->js->link('script.js');
$expected = '';
- $this->assertEqual($result, $expected, "Error creating link, expected '{$expected}', got '{$result}'.");
+ $this->assertEqual($result, $expected);
$result = $this->js->link('script');
$expected = '';
- $this->assertEqual($result, $expected, "Error creating link, expected '{$expected}', got '{$result}'.");
+ $this->assertEqual($result, $expected);
$result = $this->js->link('scriptaculous.js?load=effects');
$expected = '';
- $this->assertEqual($result, $expected, "Error creating link, expected '{$expected}', got '{$result}'.");
+ $this->assertEqual($result, $expected);
$result = $this->js->link('jquery-1.1.2');
$expected = '';
- $this->assertEqual($result, $expected, "Error creating link, expected '{$expected}', got '{$result}'.");
+ $this->assertEqual($result, $expected);
}
function testObjectGeneration() {
@@ -69,7 +69,11 @@ class JavascriptTest extends UnitTestCase {
$result = $this->js->object($object);
$expected = '{"title":"New thing", "indexes":[5, 6, 7, 8]}';
- $this->assertEqual($result, $expected, "Error generating JavaScript object, expected '{$expected}', got '{$result}'.");
+ $this->assertEqual($result, $expected);
+
+ $result = $this->js->object(array('default' => 0));
+ $expected = '{"default":0}';
+ $this->assertEqual($result, $expected);
}
function tearDown() {