Hi devs,
According to my research I couldn't find any place where the variable
$selected is set which is used in sql.php. Also this variable is used to
check indexes if indexes should be checked in sql.lib.php. I am not sure
about what is meant by checking an index. But since $selected seems to be
not initialized this code will never run. I would like to know your opinion
on this issue.
regards supun.
Hi, I just took a bug report/suggested fix from "an anonymous IRC user"
who doesn't have a SourceForge or github account. The thing is, I can't
reproduce it. Does anyone have any comment on this?
I 'm running latest 4.0.4.1 and wanted to change a server variable, but
every time I clicked on one I got a token mismatch. Turns out, line 128
of server_variables.php does:
$url = htmlspecialchars('server_variables.php?' .
PMA_generate_common_url());
The html special chars converts an '&' to & where it shouldn't. This
effectively makes it impossible to change any server variables via
phpMyAdmin. Changing it to:
$url = ('server_variables.php?' . PMA_generate_common_url());
(kill the htmlspecialchars())
works. But I'm not certain this would be the correct fix.
Hi,
I have been writing Unit Tests for classes and libraries under libraries/config/*. For isolation between different libraries, its preferred to mock certain functions. Since some of the code is functional, I tried to convert (for a start) libraries/config/validate.lib.php into a class with static methods.
However, the issue here is that mocking static methods is not really possible with PHPUnit and there are a few workarounds I came across and would like to know which one should we go for, or if there is anything better that can be done.
So, while the writer of PHPUnit specifies how to mock static methods here[0], its only possible if the static calls are to the same class.
For example, for testing FormDisplay::_validate, I need to mock PMA_config_validate. After I convert validate.lib.php to a class, say, PMA_Validator, I will have to mock PMA_Validator::config_validate, but the above solution won't work here (since PMA_Validator cannot be mocked). A workaround for this could be to pass the mocked static class as mentioned in [0] to the FormDisplay.class.php and make all static calls via that class.
For this, we could have something of this sort in the constructor of FormDisplay:
if (defined('TESTSUITE'))
$this->validator = $GLOBALS['dummyValidator'] or $this->validator = <mockedClassPassedInTheArgument>
else
$this->validator = 'PMA_Validator'
and the calls can be made like:
$caller = $this->validator; // $this->validator::config_validate won't work
$caller:config_validate();
Another solution could be what is mentioned in a blog here[1]. The problem with this solution is that the file, FormDisplay.class.php would include and hence declare the PMA_Validator class before our test suite tries to (re)declare it by extending MockProxy class.
In either case, it looks like some sort of modification would be needed to test these classes.
Please advice.
[0] http://sebastian-bergmann.de/archives/883-Stubbing-and-Mocking-Static-Metho…
[1] http://www.deanspot.org/content/mocking-static-method-calls-phpunit
--
Ayush Chaudhary
Hi devs,
I am facing a difficulty in setting up the goals for the week 5. I think I
have considerably refactored the sql.php using extract method. I would like
to hear from you whether I should consider further refactoring using
extract method or any other suggestions to work on during the next week.
Regards Supun
Hi Kasun,
I may be missing it, but in your recent work[1] is there a way to see
which users are in a usergroup?
Perhaps an additional link from the Action column of the User groups
area of the Users page with the text "View users" or something????
Copying the phpmyadmin-devel list to see if others think this would be
useful and get input on the location/label of the link.
1 - https://github.com/phpmyadmin/phpmyadmin/pull/484
Hi,
I was trying to transfer the check for "is_procedure" in sql.php to sql
parser. There I realized that "CALL" is recognized as alpha_identifier
rather than alpha_reservedWord. But CALL is a mysql reserved word. I would
like to have a clarification regarding this issue.
Regards Supun.