Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-18-2008, 04:00 PM
mel mel is offline
Junior Member
 
Join Date: Feb 2008
Posts: 11
Default PHPUnit

I'm totally new to unit testing, and am struggling immensely with it at the moment. A few days of searching for answers to various questions has been almost fruitless. I've managed to get semi-started, but I'm now stumped again.

The model class is User. After generating the skeleton then immediately running the 'tests' I was getting this error:
Zend_Db_Table_Exception: No adapter found for User

After adding some setup (autoloader, config and db), I get:
Zend_Db_Adapter_Mysqli_Exception: Can't connect to MySQL server on 'mysqlserver'

So my questions: how can I test a model class without using the database? I'm not sure that's even quite what I want to do, but as I said I'm very, very new to unit testing. Any answers/comments/suggestions/advice will be hugely appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 05:36 PM
Elemental's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 122
Default

The easiest way to have a test db with known data in it. There is also a Mock class you can use, but I'm pretty new to this stuff myself...
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk
Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:45 PM.