ZF-4070: Zend_Test_PHPUnit_ControllerTestCase::setQuery() GET params are erased during Zend_Test_PHPUnit_ControllerTestCase::dispatch()

Issue Type: Bug Created: 2008-08-26T04:52:51.000+0000 Last Updated: 2008-09-11T06:39:31.000+0000 Status: Resolved Fix version(s): - 1.6.1 (15/Sep/08)

Reporter: Piotr Czachur (zimnyx) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Test_PHPUnit

Related issues: Attachments:


<pre class="highlight"><?php
class Controllers_Default_IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
    public function testIndexAction() 
        $this->request->setQuery('mr', 'proper');


....................................array(4) {
  string(5) "index"
  string(5) "index"
  string(7) "default"
  string(4) "bond"

Why 'mr' GET param is not set?


Posted by Matthew Weier O'Phinney (matthew) on 2008-08-26T05:51:36.000+0000

The parameter is not set because you passed parameters via the query string; these overwrite those previously set with setQuery().

Either set all GET parameters using setQuery() or pass them as part of the URL to dispatch.

Posted by Matthew Weier O'Phinney (matthew) on 2008-08-26T07:30:32.000+0000

The following better demonstrates the issue:

<pre class="highlight">
    public function testIndexAction()
        $this->request->setQuery('mr', 'proper')
                      ->setQuery('james', 'bond');
        $this->fail(var_export($this->request->getParams(), 1));

The expected result would show both the 'mr' and 'james' parameters in the request. However, these are not present. exporting getQuery() results in an empty array as well.

Posted by Matthew Weier O'Phinney (matthew) on 2008-08-26T07:31:35.000+0000

Scheduling for next mini release (1.6.1)

Posted by Matthew Weier O'Phinney (matthew) on 2008-09-11T06:39:30.000+0000

Fixed in trunk and 1.6 release branch; will release with 1.6.1

Have you found an issue?

See the Overview section for more details.


© 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.