问题
I have define below in unit test
$p = new Parameters();
$p->set('email','test@gmail.com');
$p->set('password','abcd');
$p->set('username','abcd');
$this->getRequest()->setMethod('POST',$p);
$this->getRequest()->setPost($p);
$this->dispatch('/default/register');
$this->assertModuleName('default');
//assertActionName
$this->assertResponseStatusCode(200);
$this->assertControllerName(TestController::class);
$this->assertControllerClass('TestController');
$this->assertActionName('register');
$this->assertMatchedRouteName('register');
I am echo the post array in the module/default/src/TestController but this returning empty error on CLI while printing on browser. Below is the output of CLI
PHPUnit 6.2.4 by Sebastian Bergmann and contributors.
Starting test 'DefaultTest\Controller\TestControllerTest::testRegisterUser'. Array ( )
来源:https://stackoverflow.com/questions/53946184/zf3-unit-testing-controllers-post-get-data-not-sending