add test case for PMA_Table and PMA_TableSearch #514

Merged
merged 14 commits into from Jul 19, 2013

Conversation

Projects
None yet
3 participants
Contributor

adamgsoc2013 commented Jul 17, 2013

No description provided.

@ayushchd ayushchd commented on the diff Jul 18, 2013

test/classes/PMA_Table_test.php
+ $default_type = 'USER_DEFINED';
+ $default_value = 'VARCHAR';
+ $extra = 'AUTO_INCREMENT';
+ $comment = 'PMA comment';
+ $field_primary = 'new_name';
+ $index = array('new_name');
+ $move_to = 'new_name';
+
+ $result = PMA_Table::generateAlter(
+ $oldcol, $newcol, $type, $length,
+ $attribute, $collation, $null, $default_type, $default_value,
+ $extra, $comment, $field_primary, $index, $move_to
+ );
+
+ $expect = "";
+ if (PMA_DRIZZLE) {
@ayushchd

ayushchd Jul 18, 2013

Contributor

I think it would be better to modify the constant PMA_DRIZZLE by using the runkit extension so that both the conditions can be tested.

@ayushchd

ayushchd Jul 18, 2013

Contributor

@adamgsoc2013,

I think according to your latest commit, 9e41ec7 PMA_DRIZZLE will never be set to true and it will always execute the other (else) condition. What I meant was, using runkit, you can first set PMA_DRIZZLE to be true, and test the corresponding expectation. And then again, you can set it to false and check the other expectation.

@adamgsoc2013

adamgsoc2013 Jul 18, 2013

Contributor

@ ayushchd
fixed. thanks

Contributor

adamgsoc2013 commented Jul 18, 2013

thanks ayushch,

I have tested on different setting of PMA_DRIZZLE using runkit. thanks
latest commit adamgsoc2013/phpmyadmin@9e41ec7

Contributor

adamgsoc2013 commented Jul 18, 2013

fixed, thanks

@nijel nijel commented on an outdated diff Jul 18, 2013

test/classes/PMA_Table_test.php
$GLOBALS['dbi'] = $dbi;
+
+ //RunKit
+ if (!defined("PMA_DRIZZLE")) {
+ define("PMA_DRIZZLE", true);
+ }
+
+ if (PMA_DRIZZLE) {
+ if (PMA_HAS_RUNKIT) {
+ runkit_constant_redefine("PMA_DRIZZLE", false);
+ }
+ }
@nijel

nijel Jul 18, 2013

Owner

So you end up testing with PMA_DRIZLLE=true without runkit and PMA_DRIZZLE=false without it. Would not be better to test both cases (at least with runkit)?

Contributor

adamgsoc2013 commented Jul 18, 2013

Hi Michal,
I add more case for PMA_TableSearch in this pull request.

For the runkit env, adamgsoc2013/phpmyadmin@29e6204

on the runkit env, I test "PMA_DRIZZLE=false"
on the env without runkit, I test "PMA_DRIZZLE=true"

thanks

Owner

nijel commented Jul 19, 2013

You should IMHO test both cases with runkit.

Owner

nijel commented Jul 19, 2013

Anyway I'm merging this, but please add second case (with a sub class which will just change the flag with runkit and mark itself as skipped otherwise).

@nijel nijel added a commit that referenced this pull request Jul 19, 2013

@nijel nijel Merge pull request #514 from adamgsoc2013/UT_plu_table
add test case for PMA_Table and PMA_TableSearch
75838f2

@nijel nijel merged commit 75838f2 into phpmyadmin:master Jul 19, 2013

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment