UnitTest with laminas/laminas-test - Request is not an HTTP Request

I try to set up unit tests for a new project. Added unittest and the laminas-test module. My issue is when i just follow the tutorials, i run into an error not getting the right request type in the application.

Error : Call to undefined method Laminas\Console\Request::getQuery()

i call the unit test by cmd:

The test function has one line:

I get a console request instead of a php environment request. Which is not very surprising when called by cmd. But how can i setup test for the controllers with the right request type?

Any hints how to solve this?

Thats the test class


namespace SbDocument\Test;

use Laminas\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;

class DocumentTest extends AbstractHttpControllerTestCase
    protected function setUp(): void
        if (!defined('ROOT_PATH')) {
            define('ROOT_PATH', realpath(__DIR__ . '/../../../../../'));
            include ROOT_PATH . '/config/application.test.config.php'

    public function testIndexActionCanBeAccessed()

Which version of laminas-test are you using?

(In the last version the support of laminas-console was removed.)

No, that has nothing to do with it. If you use the class for HTTP controller tests then everything should work and the correct requests are generated.

i use laminas-test 4.0.0
i have laminas-console in use, and it seems to be the problem. Thanks for your Help.

laminas-console has been obsolete for a while, use laminas-cli instead.

Hi stefan So i am going through this issue presently how did you resolve it

laminas-console is who changes the request type. remove it (or at least temporarily) and you can run tests