[Phpmyadmin-devel] How to write unit test cases for DBI class?

Michal Čihař michal at cihar.com
Thu Aug 1 13:03:30 CEST 2013


Dne Wed, 31 Jul 2013 23:50:33 +0800
adam <adamgsoc2013 at gmail.com> napsal(a):

> I am writing unit test cases for DBI classes. in the code base: [1], including DBI class:
> * DBIMysql.class.php
> * DBIMysqli.class.php
> But I have no idea how to test them.
> two methods:
> 1.  Mock built-in PHP DB client API  ( ig: mysql_connect)
> they call PHP DB client API finally, but I don't know how I can mock this kind of built-in functions

You can use runkit to replace them for testing.

	Michal Čihař | http://cihar.com | http://blog.cihar.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20130801/3331657f/attachment.sig>

More information about the Developers mailing list