Skip to content
Permalink
Browse files

Change how a single view var is inferred with `'_serialize' => true`

Now if a single view var is set it's inferred as `'_serialize' => ['var']`
instead of `'_serialize' => 'var'`.

Closes #7482
  • Loading branch information...
ADmad committed Sep 29, 2015
1 parent 543b49b commit ddc39021209a767921d723e7a198169aae6381ad
Showing with 8 additions and 4 deletions.
  1. +0 −4 src/View/JsonView.php
  2. +8 −0 tests/TestCase/View/JsonViewTest.php
@@ -173,10 +173,6 @@ protected function _dataToSerialize($serialize = true)
return null;
}
if (count($data) === 1) {
return current($data);
}
return $data;
}
@@ -119,6 +119,14 @@ public static function renderWithoutViewProvider()
json_encode(['no' => 'nope', 'user' => 'fake', 'list' => ['item1', 'item2']])
],
// Test render with True in _serialize and single var
[
['no' => 'nope'],
true,
null,
json_encode(['no' => 'nope'])
],
// Test render with empty string in _serialize.
[
['no' => 'nope', 'user' => 'fake', 'list' => ['item1', 'item2']],

0 comments on commit ddc3902

Please sign in to comment.
You can’t perform that action at this time.