By default, ZF won't load a class named "Mymodel". You'll need to prefix the class name with "Model_" (or "Default_Model_" if you are using the module autoloader).
-- Hector On Tue, May 11, 2010 at 12:26 PM, afx114 <[email protected]> wrote: > > Hi, > > In my application.ini, I am specifying additional include paths like so: > > includePaths.library = APPLICATION_ROOT "/library" > includePaths.models = APPLICATION_PATH "/models" > > However, it does not appear as if these are being set in my unit tests. > When running a test I get an error that my model is not found: > > Fatal error: Class 'Mymodel' not found in > /path/to/app/tests/application/models/MymodelTest.php on line 28 > > When I check the include path by doing die(get_include_path()) inside the > test method, it does not include the includePaths specified in my > application.ini. Anyone know why? Here's what my test class looks like: > > class Model_MymodelTest extends Zend_Test_PHPUnit_ControllerTestCase > { > public function setUp() > { > $this->bootstrap = array($this, 'appBootstrap'); > parent::setUp(); > } > > public function tearDown() > { > parent::tearDown(); > } > > public function appBootstrap() > { > $this->application = new Zend_Application(APPLICATION_ENV, > APPLICATION_PATH . '/configs/application.ini'); > $this->application->bootstrap(); > } > > public function testStuff() > { > $myModel = new Mymodel(); > ... assertions here ... > } > } > > All other testing works, the problem is that my tests can't seem to find my > models because includePaths aren't being set. > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/PHPUunit-and-includePaths-specified-in-application-ini-tp2177242p2177242.html > Sent from the Zend Framework mailing list archive at Nabble.com. >
