Issues

ZF2-54: Default value is not corresponding with the Unit Test

Issue Type: Bug Created: 2011-01-04T06:21:41.000+0000 Last Updated: 2011-09-03T08:10:01.000+0000 Status: Resolved Fix version(s): Reporter: Jerry Verhoef (lucard) Assignee: Benoît Durand (intiilapa) Tags: - Zend\Json

  • zf-crteam-padraic
  • zf-crteam-priority

Related issues: - ZF-8618

Attachments:

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.

<pre class="highlight">
/**
     * 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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts