If you have a good reason to use ZF2 in the same suite as PhpBrowser,
you can create your own helper class and load ZF2 module as a dependency.
Configuration:
modules:
enabled:
- PhpBrowser:
url: http://localhost/
- \Helper\Zf2Helper:
depends: ZF2
Code tests/_support/Helper/Zf2Helper.php:
<?php
namespace Helper;
class Zf2Helper extends \Codeception\Module
{
private $zf2;
public function _inject(\Codeception\Module\ZF2 $zf2)
{
$this->zf2 = $zf2;
}
public function doSomethingWithZf2
{
$this->zf2->doSomething();
}
}
Update:
Since Codeception 2.2.2 release it is possible to load services part of ZF2 which enables grabServiceFromContainer method.
Configuration:
modules:
enabled:
- PhpBrowser:
url: http://localhost/
- ZF2
part: services