Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Chanaka committed May 15, 2012
2 parents 6f6294a + 8ec765a commit b3bcc87
Show file tree
Hide file tree
Showing 9 changed files with 460 additions and 230 deletions.
8 changes: 4 additions & 4 deletions .gitignore
@@ -1,9 +1,9 @@
# Directory for creating releases
/release/
# Configuration files
config.inc.php
config.header.inc.php
config.footer.inc.php
/config.inc.php
/config.header.inc.php
/config.footer.inc.php
# Upload/save dirs
/upload/
/save/
Expand Down Expand Up @@ -36,4 +36,4 @@ revision-info.php
phpunit.xml
/test/bootstrap.php
# Jenkins
/build/
/build/
13 changes: 1 addition & 12 deletions libraries/Config.class.php
Expand Up @@ -1387,7 +1387,7 @@ public function getCookiePath()
{
static $cookie_path = null;

if (null !== $cookie_path) {
if (null !== $cookie_path && !defined('TESTSUITE')) {
return $cookie_path;
}

Expand Down Expand Up @@ -1435,17 +1435,6 @@ function enableBc()
}
}

/**
* Saves config file.
*
* @todo finish
*
* @return void
*/
function save()
{
}

/**
* returns options for font size selection
*
Expand Down
6 changes: 3 additions & 3 deletions libraries/common.lib.php
Expand Up @@ -179,15 +179,15 @@ function PMA_getImage($image, $alternate = '', $attributes = array())
}

/**
* Displays the maximum size for an upload
* Returns the formatted maximum size for an upload
*
* @param integer $max_upload_size the size
*
* @return string the message
*
* @access public
*/
function PMA_displayMaximumUploadSize($max_upload_size)
function PMA_getFormattedMaximumUploadSize($max_upload_size)
{
// I have to reduce the second parameter (sensitiveness) from 6 to 4
// to avoid weird results like 512 kKib
Expand Down Expand Up @@ -3314,7 +3314,7 @@ function PMA_browseUploadFile($max_upload_size)
echo '<div id="upload_form_status" style="display: none;"></div>';
echo '<div id="upload_form_status_info" style="display: none;"></div>';
echo '<input type="file" name="import_file" id="input_import_file" />';
echo PMA_displayMaximumUploadSize($max_upload_size) . "\n";
echo PMA_getFormattedMaximumUploadSize($max_upload_size) . "\n";
// some browsers should respect this :)
echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/sql_query_form.lib.php
Expand Up @@ -442,7 +442,7 @@ function PMA_sqlQueryFormUpload()
echo __('Browse your computer:') . '</legend>';
echo '<div class="formelement">';
echo '<input type="file" name="sql_file" class="textfield" /> ';
echo PMA_displayMaximumUploadSize($GLOBALS['max_upload_size']);
echo PMA_getFormattedMaximumUploadSize($GLOBALS['max_upload_size']);
// some browsers should respect this :)
echo PMA_generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n";
echo '</div>';
Expand Down
2 changes: 1 addition & 1 deletion tbl_change.php
Expand Up @@ -918,7 +918,7 @@ class="textfield" <?php echo $unnullify_trigger; ?>
if ($this_field_max_size > $max_field_sizes[$field['pma_type']]) {
$this_field_max_size = $max_field_sizes[$field['pma_type']];
}
echo PMA_displayMaximumUploadSize($this_field_max_size) . "\n";
echo PMA_getFormattedMaximumUploadSize($this_field_max_size) . "\n";
// do not generate here the MAX_FILE_SIZE, because we should
// put only one in the form to accommodate the biggest field
if ($this_field_max_size > $biggest_max_file_size) {
Expand Down
94 changes: 83 additions & 11 deletions test/classes/Advisor_test.php
Expand Up @@ -10,6 +10,7 @@
* Include to test.
*/
require_once 'libraries/Advisor.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/core.lib.php';
Expand All @@ -24,6 +25,11 @@ public function setup()
}

/**
* Tests string escaping
*
* @param string $text Text to escape
* @param string $expected Expected output
*
* @dataProvider escapeStrings
*/
public function testEscape($text, $expected)
Expand All @@ -49,6 +55,12 @@ public function testParse()
}

/**
* Test for adding rule
*
* @param array $rule Rule to test
* @param array $expected Expected rendered rulle in fired/errors list
* @param string $error Expected error string (null if none error expected)
*
* @depends testParse
* @dataProvider rulesProvider
*/
Expand All @@ -71,32 +83,92 @@ public function rulesProvider()
{
return array(
array(
array('justification' => 'foo', 'name' => 'Basic', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array('justification' => 'foo', 'id' => 'Basic', 'name' => 'Basic', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array(
'justification' => 'foo',
'name' => 'Basic',
'issue' => 'issue',
'recommendation' => 'Recommend'
),
array(
'justification' => 'foo',
'id' => 'Basic',
'name' => 'Basic',
'issue' => 'issue',
'recommendation' => 'Recommend'
),
null,
),
array(
array('justification' => 'foo', 'name' => 'Variable', 'issue' => 'issue', 'recommendation' => 'Recommend {status_var}'),
array('justification' => 'foo', 'id' => 'Variable', 'name' => 'Variable', 'issue' => 'issue', 'recommendation' => 'Recommend <a href="server_variables.php?lang=en&amp;token=token#filter=status_var">status_var</a>'),
array(
'justification' => 'foo',
'name' => 'Variable',
'issue' => 'issue',
'recommendation' => 'Recommend {status_var}'
),
array(
'justification' => 'foo',
'id' => 'Variable',
'name' => 'Variable',
'issue' => 'issue',
'recommendation' => 'Recommend <a href="server_variables.php?lang=en&amp;token=token#filter=status_var">status_var</a>'
),
null,
),
array(
array('justification' => '%s foo | value', 'name' => 'Format', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array('justification' => '0 foo', 'id' => 'Format', 'name' => 'Format', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array(
'justification' => '%s foo | value',
'name' => 'Format',
'issue' => 'issue',
'recommendation' => 'Recommend'
),
array(
'justification' => '0 foo',
'id' => 'Format',
'name' => 'Format',
'issue' => 'issue',
'recommendation' => 'Recommend'
),
null,
),
array(
array('justification' => '%s% foo | value', 'name' => 'Percent', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array('justification' => '0% foo', 'id' => 'Percent', 'name' => 'Percent', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array(
'justification' => '%s% foo | value',
'name' => 'Percent',
'issue' => 'issue',
'recommendation' => 'Recommend'
),
array(
'justification' => '0% foo',
'id' => 'Percent',
'name' => 'Percent',
'issue' => 'issue',
'recommendation' => 'Recommend'
),
null,
),
array(
array('justification' => '"\'foo', 'name' => 'Quotes', 'issue' => 'issue', 'recommendation' => 'Recommend"\''),
array('justification' => '"\'foo', 'id' => 'Quotes', 'name' => 'Quotes', 'issue' => 'issue', 'recommendation' => 'Recommend"\''),
array(
'justification' => '"\'foo',
'name' => 'Quotes',
'issue' => 'issue',
'recommendation' => 'Recommend"\''
),
array(
'justification' => '"\'foo',
'id' => 'Quotes',
'name' => 'Quotes',
'issue' => 'issue',
'recommendation' => 'Recommend"\''
),
null,
),
array(
array('justification' => 'foo | fsafdsa', 'name' => 'Failure', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array(
'justification' => 'foo | fsafdsa',
'name' => 'Failure',
'issue' => 'issue',
'recommendation' => 'Recommend'
),
array(),
'Failed formatting string for rule \'Failure\'. PHP threw following error: Use of undefined constant fsafdsa - assumed \'fsafdsa\'',
),
Expand Down

0 comments on commit b3bcc87

Please sign in to comment.