Codeception / Codeception/module-laminas

Documentation how to mock controller plugin factory

未关闭
#28 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
1
派生
7
PR 合并指标
30 天内没有已合并 PR

描述

Hello, i am trying to mock factory for controller plugin `FooPlugin`.

```
$this->getServiceLocator()->setAllowOverride( true );

$controllerPluginManager = $this->getServiceLocator()->get( 'ControllerPluginManager' );
$controllerPluginManager->setAllowOverride( true );
$controllerPluginManager->setFactory( FooPlugin::class, FooPluginTestFactory::class );
$controllerPluginManager->setAllowOverride( false );

$this->getModule( Laminas::class )->client->addServiceToContainer( 'ControllerPluginManager', $controllerPluginManager);

$this->getServiceLocator()->setAllowOverride( false );
```

i debugged internal code and see that Laminas overrides my factory `FooPluginTestFactory` to basic `FooPluginFactory`, which is provided in basic config. it occurred indside this https://github.com/Codeception/module-laminas/blob/00d6cf8ae6a10ef52b3569febf1d6277d7b3b8e1/src/Codeception/Lib/Connector/Laminas.php#L196-L205

after next line:
```
// Load modules
$serviceManager->get('ModuleManager')->loadModules();
```

do i make something wrong?
what is the suggested way to make it correctly?

thanks!

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start with src/Codeception/Lib/Connector/Laminas.php around lines 196-205 and the service-manager setup shown in the issue. Trace what happens after ModuleManager->loadModules(), then document the supported way to mock a controller plugin factory and confirm that the guidance addresses the reported factory override.

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
documentation, testing
Issue 类型
文档
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。