2013/7/3 Ayush Chaudhary ayushchd@gmail.com:
Hi,
Is there a reason why validation.lib.php is not a class with public static method? Is it okay to convert it to a class with all methods' access specifier as public static?
Did you mean the PMA_SQLValidator class in libraries/sqlvalidator.class.php? I didn't find a validation.lib.php, or something similar, in the PMA codebase, that contains a class. (libraries/config/validate.lib.php doesn't contain a class)
Assuming you mean PMA_SQLValidator, this is not a static class, ie. it has to be instanciated (= turned into an object), so it can't have static methods. [1] To use (or test) this class, you have to create an instance and call the methods from that instance, fe.
$validator = new PMA_SQLValidator();
$validator->start();
(see libraries/sqlvalidator.lib.php for an example on how to instanciate and use the PMA_SQLValidator class)
BTW : Testing a class instance can sometimes be tricky, especially if it communicates with, or uses another class. If this is the case, you will have to use Mock objects [0] and Stubs to simulate the expected behaviour of the other class.
I hope this helps.
[0] http://phpunit.de/manual/3.0/en/mock-objects.html [1] explanation of instances and static members. It's explained for Java so the syntax doesn't match 100% with PHP, but the concept is analogous : http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
Kind regards,
Dieter
-- Ayush Chaudhary
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
-- Kind regards,
Dieter Adriaenssens