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


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?


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.

The following better demonstrates the issue:

    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.

Scheduling for next mini release (1.6.1)

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