我有一个控制器extends AbstractHttpControllerTestCase。
我尝试将参数(some_uuid)传递给 dispatch() 函数(在我的 testFoo 函数中):
$this->dispatch('/my-special-url', 'POST', ['some_uuid' => '16294469-f531-40d6-89e9-3ab677a47c45']);
$this->assertResponseStatusCode(200);
为什么参数不在控制器中?
[编辑] 没有很多代码。但是,如果有人想看到一切:
class ProductStockAjaxControllerTest extends AbstractHttpControllerTestCase
{
    protected function setUp(): void
    {
        $configOverrides = [];
        $this->setApplicationConfig(ArrayUtils::merge(
            include __DIR__ . '/../../../../../../config/application.config.php',
            $configOverrides
        ));
        parent::setUp();
        /** @var UserService $userService */
        $userService = $this->getApplication()->getServiceManager()->get(UserService::class);
        $userService->setSessionHashManually('151956ad612953e61533b9d2d5844d65df5b5c8c4e35f5e49375ef77711b6676');
    }
    public function testIndexActionCanBeAccessed()
    {
        $this->dispatch('/my-special-url', 'POST'
        , ['some_uuid' => '16294469-f531-40d6-89e9-3ab677a47c45', 'ano_uuid' => '0a6cea79-9869-4da4-b8db-02bd21d1488a']);
        //$this->assertResponseStatusCode(200);
        $this->assertModuleName('lerp');
        $this->assertControllerName(ProductStockAjaxController::class);
        $this->assertControllerClass('ProductStockAjaxController');
        $this->assertMatchedRouteName('my_special_url');
    }
}