zend framework - Autoloading phpunit test classes from another module in zf2 -
i trying reuse test classes module current module. directory structure looks like:
home/ module.php config/ module.config.php src/ home/ <code files> test/ phpunit.xml bootstrap.php hometest/ <test code files> loader/ module.php config/ module.config.php src/ loader/ <code files> test/ phpunit.xml bootstrap.php loadertest/ <test code files>
i running phpunit test classes in loader/test/ folder , need reuse classes home/test/hometest/model.
i tried using in bootstrap file:
autoloaderfactory::factory( array( 'zend\loader\standardautoloader' => array( 'autoregister_zf' => true, 'namespaces' => array( __namespace__ => __dir__ . '/' . __namespace__, 'hometest' => __dir__ . '/home/test/hometest', ), ), ) );
i getting error above loading mechanism:
fatal error: class 'hometest\model\usertabletest' not found
you need navigate path loader/test
home/test
, try this...
autoloaderfactory::factory( array( 'zend\loader\standardautoloader' => array( 'autoregister_zf' => true, 'namespaces' => array( __namespace__ => __dir__ . '/' . __namespace__, 'hometest' => __dir__ . '/../../home/test/hometest', ), ), ) );
Comments
Post a Comment