0

I am trying to reuse test classes from another module into my current module. My 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 am running phpunit test classes in Loader/test/ folder and need to reuse classes from Home/test/Hometest/Model.

I tried using this in my bootstrap file:

AutoloaderFactory::factory( array( 'Zend\Loader\StandardAutoloader' => array( 'autoregister_zf' => true, 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__, 'HomeTest' => __DIR__ . '/Home/test/HomeTest', ), ), ) ); 

I am getting this error with the above loading mechanism:

Fatal error: Class 'HomeTest\Model\UserTableTest' not found 

1 Answer 1

1

You need to navigate back up the path from Loader/test to get to Home/test, try this...

AutoloaderFactory::factory( array( 'Zend\Loader\StandardAutoloader' => array( 'autoregister_zf' => true, 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__, 'HomeTest' => __DIR__ . '/../../Home/test/HomeTest', ), ), ) ); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.