Re: PEAR Quality (vs. Quantity) RFC
| From: | Harry Fuecks | Date: | Tue, 13 May 2003 22:46:41 +0000 |
| Subject: | Re: PEAR Quality (vs. Quantity) RFC | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16227@lists.php.net to get a copy of this message | ||
Don't know if you've run into this project: http://www.lastcraft.com/simple_test.php - it provides a mechanism for creating "Mock Objects" so for the example of interacting with a database via MDB, it's possible to create a "Mock Class" for MDB which provides the same API and returns results without actually needing a real database. That won't suit every test scenario but can help alot. The Mock Classes it generates should work with PEAR::phpUnit as is. I spoke to the author a couple of weeks ago and there's a chance he may submit SimpleTest to PEAR once it reaches a stable release.
On Tue, 13 May 2003 12:43:53 +0100, Davey <davey@php.net> wrote:
What do we do when, for example our class interacts with a database? Should we provide an MDB XML database definition file and then it could be created on the fly after upload to pearweb? then pearweb runs the unit tests... if we do this, unit tests will not work properly on users machines... unless we add something like this: ---- $ pear make-tests <package> <package> requires a database for its tests, please choose an option from those below: 1. Create Database and continue tests 2. Create Tables in existing Database 3. Skip Tests that require database 4. Skip all Tests Choose one: 1 Please enter a database name: foo Please enter a username: bar Please enter a password: baz ... Database generated, continuing tests <unit tests done here> All tests were successful, remove the database [Y/n]: Y Database removed. $ ---- You get the idea. this may not only mean additions to the pear command, but also phpUnit, package.xml (we could define what unit tests are there, whether or not they need a database and where the database schema is)