Codeception / Codeception/module-laminas
Documentation how to mock controller plugin factory
- Ngôn ngữ chính
- PHP
- Star
- 1
- Fork
- 7
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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!
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- documentation, testing
- Loại issue
- Tài liệu
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100