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

adam adamgsoc2013 at gmail.com
Wed Jul 31 17:50:33 CEST 2013


Hi all,

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

2. DB real operations
If try to test with real data, I think It is not accessible, because I need to connect to DB with username and password.


so I think method 1 is more flexible, Can someone give me some advice? thanks

[1] https://github.com/phpmyadmin/phpmyadmin/tree/master/libraries/dbi


Adam


More information about the Developers mailing list