On Mon, May 14, 2012 at 5:30 PM, Chanaka Dharmarathna <pe.chanaka.ck@gmail.com> wrote:


On Mon, May 14, 2012 at 4:32 PM, Michal Čihař <michal@cihar.com> wrote:
Hi

First of all please try to remove useless quoting in the email, it
makes them easier to read.

Dne Sun, 13 May 2012 16:04:17 +0530
Chanaka Dharmarathna <pe.chanaka.ck@gmail.com> napsal(a):

> I set up the testing environment in my machine and now evolving with the
> improvements of unit tests for some modified function.
>
> When I run unit test for "PMA_showMessage" function in "common.lib.php"
> file, it gives me some fatal errors. (Call to undefined function
> PMA_warnMissingExtension() ...)
> I used the command : $phpunit
> test/libraries/common/PMA_showMessage_test_disabled.php
>
> Do you have any idea on this ?

Probably the test is missing some includes, many of tests were not
really tested standalone.

--
       Michal Čihař | http://cihar.com | http://blog.cihar.com

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Phpmyadmin-devel mailing list
Phpmyadmin-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel


Hi Michal,

I'll follow your instructions Marc.

Yes, that is the case. I tried with including around three additional files, but again the error is due to not including some necessary files.
Is there any easier way to run this unit tests independent from the other tests ?

As well, I'm going to do some modifications regarding to improve readability of the code.
For functions which are not too small, I'm going to add one empty line, just after function declaration and just before the end of the function.

Ex :-
function PMA_setDisplayMode($params)
{

// function body after empty line
----
----
// end of the function body

} // end of the function after empty line

Hope this is more readable. Shall I use this ?


Regards !
--
____________________________________

Chanaka Indrajith
Bsc.Computer Engineering Undergraduate
Faculty of Engineering
University of Peradeniya
Sri Lanka
____________________________________


Hi Michal,

I have introduced two small functions to reduce the code repetition in PMA_getVerticalTable() function in display_tbl.lib.php file.
Both functions are using the global variable $vertical_display.

Now I'm trying to implement unit tests for those functions.
Since there is global variable, it represent null while run the test.
Is there any way to implement test cases for this kind of functions ?

As well, is it possible to implement tests for functions like PMA_getTableNavigation() which is return a large string ?
If possible, Can you give me some guidance to implement tests for that kind of functions.

Please note that above function names used in my repository [0].

[0] : https://github.com/Chanaka/phpmyadmin

Regards !
--
____________________________________

Chanaka Indrajith
Bsc.Computer Engineering Undergraduate
Faculty of Engineering
University of Peradeniya
Sri Lanka
____________________________________