I'm struggling in getting a PHPUnit test to work with ZF2.
My directory structure looks as follows
project
- src
- config, data, module, public, vendor
- init_autoloader.php
- test
- bootstrap.php
- SimpleTest.php
The application itself works well.
Now for running PHPUnit tests, my bootstrap.php looks as follows
putenv('ZF2=../src/vendor/zendframework/zendframework/library');
$loader = include '../src/vendor/autoload.php';
include '../src/init_autoloader.php';
This works for ZF2 related things but does not find my module. I then read that I have to add the following line to my bootstrap.php
Zend\Mvc\Application::init(include '../src/config/application.config.php');
But now I get the following error:
PHP Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (Mymodule) could not be initialized.' in /Users/_/src/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:139
Unfortunately, I was not able to resolve this issue. What did I do wrong? And how can I make this work?
Thank you very much.