ZF2-54: Default value is not corresponding with the Unit Test
Description
The Unit test of ZendTest\Controller\Action\Helper\AutoCompleteTest is expecting the static method JSON::decode to return an array by default. While it is returning an StdObject by default.
/**
* Decodes the given $encodedValue string which is
* encoded in the JSON format
*
* Uses ext/json's json_decode if available.
*
* @param string $encodedValue Encoded in JSON format
* @param int $objectDecodeType Optional; flag indicating how to decode
* objects. See {@link Zend_Json_Decoder::decode()} for details.
* @return mixed
* @throws Zend\Json\Exception\RuntimeException
*/
public static function decode($encodedValue, $objectDecodeType = self::TYPE_OBJECT)
So either the Unit is wrong or the code is wrong.
Comments
Posted by Jerry Verhoef (lucard) on 2011-01-04T06:27:24.000+0000
In ZF1, the default value was self::TYPE_ARRAY. So I would suggest to make the change in the code and leave the Unit Testing code as it is.
Posted by Jerry Verhoef (lucard) on 2011-01-04T06:39:49.000+0000
https://github.com/LuCarD/zf2/…
Posted by Benoît Durand (intiilapa) on 2011-09-03T08:08:16.000+0000
Watch the commit f7858ef.
Posted by Benoît Durand (intiilapa) on 2011-09-03T08:09:40.000+0000
Already fixed in the master.