Usage

First, you will need a bootstrap file which returns Zend\Mvc\Application. Here is an example:

useZend\Mvc\Application;chdir(__DIR__); // chdir() to application rootrequire'vendor/autoload.php';/* * why another set of config? * now that you're writing unit test * odds are that you would want to override some production settings here, * e.g. load only certain module; use a test database connection, etc*/$config=array('modules'=>array('Foo','Bar', ),'module_listener_options'=>array('config_glob_paths'=>array(__DIR__.'/test/config/{,*.}php' ),'module_paths'=>array('Foo'=>__DIR__,'vendor', ), ),));returnApplication::init($config);

Doctrine

Bootstrap your Zf2 application with the bootstrap file foo/bootstrap.php, and with Doctrine ORM support. Your EntityManager is aliased with the ServiceManager at doctrine.entitymanager.orm_default.

(Optional) You have declared the directory foo/tmp as a temporary directory somewhere in your config files - possibly for storing Proxies, and you want this directory to be created before each test; and deleted after each test. (i.e. during setUp() and teardown())